CICD

[Kubernetes] replicaset 관련 명령어

walwal_ 2023. 1. 5. 02:20

replicaset ? 특정 수의 pod 가 항상 실행되도록 함.

 

만약 pod 를 삭제시켜 필요한 포드수가 줄어들면

리플리카셋이 포드를 자동으로 만들어 포드를 유지함.


* 생성했던 리플리카셋 불러오기.

 

입력 : kubectl get replicasets || kubectl get replicaset(단일, 세부) || kubectl get rs

출력

NAME                                          DESIRED   CURRENT   READY   AGE
hello-world-rest-api-569c4879d9   1                 1                  1            23h

 

     - DESIRED : 원하는 실행 포드 수.

     - READY : 준비된 컨테이너 수.

 

 

* 리플리카셋 세부

입력 :  kubectl get rs -o wide

출력

NAME                                          DESIRED   CURRENT   READY   AGE       CONTAINERS                                               
hello-world-rest-api-569c4879d9   3                3                  3            2d17h     hello-world-rest-api  

 

IMAGES                                                                           SELECTOR

 in28min/hello-world-rest-api:0.0.1.RELEASE                  app=hello-world-rest-api,pod-templat

 

 

   - 현재  in28min/hello-world-rest-api:0.0.1.RELEASE 이미지에 묶여있고

     이 리플리카셋은  in28min/hello-world-rest-api:0.0.1.RELEASE 이 특정 이미지를 사용하는 릴리즈를 관리하는것,


* 디플로이먼트 확장.

 

입력 : kubectl scale deployment hello-world-rest-api --replicas=3(인스턴스 수)

출력 : 

deployment.apps/hello-world-rest-api scaled

 

     kubectl get pods 로 확인하면 포드가 3개임을 확인할 수 있다.

 

 


* replicaset 설명

 

입력 : kubectl explain replicaset

출력

 

DESCRIPTION:
     ReplicaSet ensures that a specified number of pod replicas are running at
     any given time.

...

'CICD' 카테고리의 다른 글

[Kubernetes] pod 관련 명령어  (0) 2023.01.05