05-16 05:32
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

miinsun

[์‹ค์Šต] ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค Ingress ๋ณธ๋ฌธ

Infra/Kubernetes

[์‹ค์Šต] ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค Ingress

miinsun 2023. 6. 13. 15:50

๐Ÿ“Œ ingress-nginx ์„ค์น˜

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.0/deploy/static/provider/baremetal/deploy.yaml

https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal-clusters

- ingress controlelr ๋™์ž‘ ํ™•์ธ

 

๐Ÿ“Œ ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ ์‹ค์Šต

- ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ์— ์‚ฌ์šฉํ•  deployment ์„ค์ •
ing-test-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: websample
spec:
  selector:
    matchLabels:
      run: websample
  strategy:
    # ๋””ํด๋กœ์ด๋จผํŠธ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋™์•ˆ ๊ธฐ๋ณธ ํŒŒ๋“œ ๊ฐœ์ˆ˜์˜ 25% ํŒŒ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ #
    # ์—…๋ฐ์ดํŠธ ์ค‘์—๋„ ์ตœ์†Œ 25% ํŒŒ๋“œ๋Š” ๋ณด์žฅํ•œ๋‹ค.
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        run: websample
    spec:
      containers:
      - image: acadx0/190713:v1
        imagePullPolicy: Always
        name: websample
        ports:
        - containerPort: 5000
          protocol: TCP
        # HTTP GET์š”์ฒญ์„ ๋ณด๋‚ด ์ปจํ…Œ์ด๋„ˆ ์ƒํƒœ๋ฅผ ์ง„๋‹จ
        livenessProbe:
          httpGet:
            path: /liveness
            port: 5000
        readinessProbe:
          httpGet:
            path: /readiness
            port: 5000
        lifecycle:
          preStop:
            httpGet:
              path: /prestop
              port: 5000
      terminationGracePeriodSeconds: 30

 

- ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ์— ์‚ฌ์šฉํ•  ingress ์„ค์ •
ing-test-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: websample-ing
spec:
  rules:
  # xip.io๋Š” ๋ชจ๋“  ip ์ฃผ์†Œ์— ์™€์ผ๋“œ์นด๋“œ DNS๋ฅผ ์ œ๊ณต
  - host: 127.0.0.1.xip.io
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: websample
            port:
              number: 5000

 

- ๋””ํ”Œ๋กœ์ด๋จผํŠธ, ์„œ๋น„์Šค, ์ธ๊ทธ๋ ˆ์Šค๋ฅผ ์ƒ์„ฑ

$ kubectl apply -f ing-test-deployment.yaml
$ kubectl expose deployment websample
$ kubectl apply -f ing-test-ingress.yaml

 

- ๋ฒ ๊ฒŒํƒ€(๋ถ€ํ•˜ํ…Œ์ŠคํŠธ ๋„๊ตฌ ์„ค์น˜)

https://github.com/tsenart/vegeta

 

GitHub - tsenart/vegeta: HTTP load testing tool and library. It's over 9000!

HTTP load testing tool and library. It's over 9000! - GitHub - tsenart/vegeta: HTTP load testing tool and library. It's over 9000!

github.com

# ๋ฒ ๊ฒŒํƒ€ ์ตœ์‹  ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „ ๋‹ค์šด
$ curl -Lo vegeta.tar.gz "https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz"

$ mkdir vegeta-temp
$ tar xf vegeta.tar.gz -C vegeta-temp

$ sudo mv vegeta-temp/vegeta /usr/local/bin

$ rm -rf vegeta.tar.gz
$ rm -rf vegeta-temp

 

Comments