전공공부
2. Replica & ReplicaSet 제작 본문
1. Replica
- multiple instance 환경에서 권장하며 replica controller가 pod 가용성을 위해서 관리
rs-definition.yaml 제작
apiVersion: v1
kind: ReplicaController
metadata:
name: myapp-rs
labels:
name: myapp
type: frontend
spec:
template:
metadata:
name: myapp
labels:
name:
type: frontend
spec:
containers:
-name: nginx-containers
image: nginx
replicas: 3
replicacontroller 확인
kubectl create -f rs-definition.yaml
kubectl get replicacontroller
2. ReplicaSet
replicaset-definition.yaml 제작
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: myapp-rs
labels:
name: myapp
type: frontend
spec:
template:
Pod 특징 나열 (metadata, spec,...)
replica: 3
selector:
matchLabels: #template 내부 나열된 pod를 특정하기 위해서 사용
type: frontend
레플리카 셋 제작 및 확인
kubectl create -f replicaset-definition.yaml
kubectl get replicaset #확인
3. Scale up하기
yaml 방식
kubectl apply -f <yaml 파일>
cli 방식
kubectl scale --replicas=6 -f <replica>
'Study > K8S' 카테고리의 다른 글
Service Account (2) | 2023.03.19 |
---|---|
Docker Security (0) | 2023.03.19 |
Secret (0) | 2023.03.03 |
configMaps (0) | 2023.03.03 |
1. K8S Pod 설치 (1) | 2023.01.29 |