728x90
- Pods는 언제든지 중지될 수 있기 때문에 레플리카 세트로 Pods 묶어서 집합체로 만든다.
- k8s 레플리카 세트로 인스턴스를 관리한다.
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: webapp
spec:
replicas: 1
selector:
matchLabels:
app: webapp
template:
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0-5
---
apiVersion: v1
kind: Pod
metadata:
name: queue
labels:
app: queue
release: "1"
spec:
containers:
- name: queue
image: richardchesterwood/k8s-fleetman-queue:release1
- 레플리카 세트 수를 1개로 webapp을 처리했다.
apiVersion: v1
kind: Service
metadata:
name: fleetman-webapp
spec:
ports:
- name: http
port: 80
nodePort: 30080
selector:
app: webapp
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
name: fleetman-queue
spec:
ports:
- name: http
port: 8161
nodePort: 30010
selector:
app: queue
type: NodePort
- 서비스도 알맞게 label을 수정해줬다.
- 이제 하나를 강제로 종료해도 1개가 계속 k8s에서 유지된다.
300x250
'Infra > 쿠버네티스 입문' 카테고리의 다른 글
쿠버네티스 입문 (7) - 네트워킹 (0) | 2023.12.13 |
---|---|
쿠버네티스 입문 (6) - 디플로이먼트 (0) | 2023.12.13 |
쿠버네티스 입문 (4) - 서비스 (0) | 2023.12.12 |
쿠버네티스 입문 (3) - 파드 (0) | 2023.12.11 |
쿠버네티스 입문 (2) - 환경 세팅 (1) | 2023.12.05 |