- Replication Controller
- helps us run multiple instances of a single pod in the k8s cluster --> providing high availability
- pod가 죽으면 기존에 선언 된 수 만큼의 새로 pod 띄워 running 상태로 유지
- 여러 노드들에 걸쳐서 healthy pod 갯수 조절 관여
- 여러 pod간의 load balance & scaling
- replication controller는 ReplicaSet보다 이전 기술, 나중에 RS로 대체됨
- replication controller definition의 spec.template은 pod의 definition과 똑같다
- spec.replicas에 개수를 적어주면 해당 갯수 만큼의 pod를 띄운다.
- kubectl get replicationcontroller(rc)
- ReplicaSet
- RC의 definition과 RS의 definition이 다른 것은 selector에 있다.
- selector.matchLabels는 pod의 metadata.labels 아래에 있는 것과 동일하게 적어줘야 한다.
- Labels and Selectors
- label은 RS가 자신이 관리할 pod를 filter하는 것에 있다.
- pod의 label을 selector.matchLabels에서 선언하면 RS는 어떤 pod를 monitor해야하는지 구별할 수 있다.
- pod 먼저 생성 후에 RS 생성하면 RS는 기존의 pod를 모니터하고 새로 pod를 생성하지 않음. 만약 pod중에 하나가 이상이 생기면 RS에 선언된 template대로 pod 생성.
- Scale 방법
- RS definition yml 파일의 replicas 변경
- kubectl scale --replicas=6 -f replicaset-definition.yaml
- kubectl scale --replicas=6 replicaset myapp-replicaset
- Self-healing
- replication controller는 pod 내의 application이 실패하면 pod를 반복적으로 재생성하여 replica를 맞춤
'CKA' 카테고리의 다른 글
Authentication (0) | 2021.09.17 |
---|---|
Cluster Maintenance (0) | 2021.09.17 |
Kubernetes Pods (1) | 2021.09.08 |
ConfigMap & Secrets (0) | 2021.09.08 |
Commands and Arguments (0) | 2021.09.08 |