Kubernetes_4

์ตœ์‹œ์—ดยท2023๋…„ 1์›” 31์ผ
0

2023.01.31


6์žฅ ์ปจํŠธ๋กค๋Ÿฌ

ReplicationContoller

๐Ÿ’ฆ yaml ํŒŒ์ผ ์ƒ์„ฑ

cat > rc-nginx.yaml 

apiVersion: v1
kind: ReplicationController
metadata:
  name: rc-nginx
spec:
  replicas: 3
  selector:
    app: webui
  template:
    metadata:
      name: nginx-pod
      labels:
        app: webui 
    spec:
      containers:
      - name: nginx-container
        image: nginx:1.14

๐Ÿ’ฆ ์‹คํ–‰ ๋ฐ ํ™•์ธ

kubectl apply -f rc-nginx.yaml

kubectl delete pod [pod์ด๋ฆ„]
์ณ๋ณด๋ฉด ๋‹ค์‹œ ์‚ด์•„๋‚œ๋‹ค.
  • replica์˜ ์ƒํƒœ๋ฅผ ํ™•์ธ
kubectl get rc
kubectl get rc rc-nginx
kubectl get replicationcontrollers
  • scale-in, scale-out
    • kubectl edit rc rc-nginx์—์„œ replica ๊ฐ’ ๋ณ€๊ฒฝ
    • kubectl scale rc rc-nginx --replicas=3 ๋ช…๋ น์–ด ์‚ฌ์šฉ
profile
์ตœ์‹œ์—ด

0๊ฐœ์˜ ๋Œ“๊ธ€