Pod의 replica 수를 늘이거나 줄이는 방법 (kubectl scale)

kubectl scale 명령어를 사용하면 됩니다. 다음은 Kubernetes 공식 문서 상에 기재된 내용입니다.

kubectl scale --replicas=3 rs/foo
# Scale a replicaset named 'foo' to 3

kubectl scale --replicas=3 -f foo.yaml
# Scale a resource specified in "foo.yaml" to 3

kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
# If the deployment named mysql's current size is 2, scale mysql to 3

kubectl scale --replicas=5 rc/foo rc/bar rc/baz
# Scale multiple replication controllers


만일 Deployment에 의해 생성된 ReplicaSet이라면 Deployment를 대상으로 scale 합니다. 다음과 같은 느낌입니다.

$ kubectl get pods -A
aeug                tour-75866547dd-26tkt                  1/1     Running   0                 19h

$ kubectl scale deployment/tour -n aeug --replicas=3
deployment.apps/tour scaled

$ kubectl get pods -A | grep tour
aeug                tour-75866547dd-26tkt                  1/1     Running   0                 19h
aeug                tour-75866547dd-4pwc9                  1/1     Running   0                 2m40s
aeug                tour-75866547dd-wbrmn                  1/1     Running   0                 2m40s




지금 바로 와탭 계정을 만들고 15일 동안 무료로 쿠버네티스 모니터링을 시작해보세요. 와탭 쿠버네티스는 어떠한 모니터링 자원없이도 시작할 수 있는 SaaS (Software as a Service) 제품입니다.

댓글

이 블로그의 인기 게시물

YAML 파일을 이용한 쿠버네티스 Pod 생성 방법

WhaTap Kubernetes Day 2024

[기사] 와탭랩스, 쿠버네티스 통합 모니터링으로 운영자 업무 효율 극대화