19버전에서 레플리카셋 이 등장 좀더 개선됨 !
https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
조회 : kubectl get rs
상세조회: kubectl describe rs NAME
삭제: kubectl delete rs NAME
기본설정이 5분
yaml 파일 만들기
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
kubectl create -f http-go-rc.yaml
kubectl get rc
kubectl get pod
pod NAME deleted 후 다시 kubectl get pod 하면 새로생김
kubectl get pod --show-labels
kubectl label pod NAME app- 삭제후 kubectl get pod --show-labels 하면 확인가능
node 한 끈길경우 임시 pod가 생기고 복구시 임시 pod 는사라지고 다시 연결되는걸 확인할수있음 kubectl get nodes -w, kubectl get pod-w,
kubectl get pod -o wide
수정 방법
a. kubectl scale rc NAME --replicas=5
b. sudo apt install vim 설치 후 kubectl edit rc NAME 하면 vim으로 열림 spec-에있는 replicas 수정
c. vim NAME 에서 수정한 파일을 kubectl apply -f NAME 하면 configured 됨