반응형
- ReplicaSet은 ReplicationController와 똑같은 역할(Pod의 갯수 보장)
- selector
- matchLabels:
- 형식: component: redis
- matchExpressions:
-
- {key: tier, operator: In, values: [cache]}
- {key: environment, operator: NotIn, values: [dev]}
-
- matchExpressions 연산자
- In: key와 values를 지정하여 key, value가 일치하는 pod만 연결
- NotIn: key는 일치하고 value는 일치하지 않는 Pod에 연결
- Exists: key에 맞는 label의 Pod를 연결
- DoseNotExist: key와 다른 label의 Pod를 연결
- matchLabels:
- selector
In | Exists |
spec: replicas: 3 selector: matchExpressions: - {key: version, operator: In, value: [”1.14”]} template: |
spec: replicas: 3 selector: matchExpressions: - {key: version, operator: Exists} template: |
- 정의
ReplicationContorller-definition (정의) | Replicaset definition (정의) |
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 |
apiVersion: apps/v1 kind: ReplicaSet metadata: name: rs-nginx spec: replicas: 3 selector: matchLabels: app: webui template: metadata: name: nginx-pod labels: app: webui spec: containers: - name: nginx-container image: nginx:1.14 |
- 컨트롤러만 삭제 하고 Pod는 삭제 안하는 방법
# kubectl delete rs [rs 명] **--cascade=false
--cascade=false : 연쇄 삭제 기능을 비활성화 (default=true)**
반응형
'K8S' 카테고리의 다른 글
DaemonSet + RollingUpdate (0) | 2025.02.07 |
---|---|
Rolling Update를 위한 Deployment (0) | 2025.02.07 |
ReplicationController란? (0) | 2025.02.07 |
Pod 환경변수 설정과 실행 패턴 (0) | 2025.02.07 |
kubectl 명령어 자동완성 _get_comp_words_by_ref: command not found 에러 발생시 (ubuntu 20.04) (0) | 2025.01.13 |