본문 바로가기
IT Tech/Cloud Native

[CKA] Replication, ReplicaSet

by 웃는 얼굴, 친절한 말, 따뜻한 마음 2022. 2. 28.
728x90

#ReplicationController 생성 YAML 파일

apiVersion: v1
kind: ReplicationController
metadata:    // ReplicationController 관련 설정
  name: 
  labels:
    app:
    type:
spec:
  template:   //pod 관련 설정
    metadata:
      name: 
      labels:
        app:
        type:
    spec:
      containers:
      - name:
        image:

replicas: 3

  

# YAML파일로 Replication Controller 생성

kubectl create -f rc.yaml

 

# RC 리스팅 조회

kubectl get replicationcontroller

 

# replicas에 설정된 수만큼 pod 존재여부 확인

kubectl get pods

 

#ReplicaSet 생성 YAML 파일

apiVersion: apps/v1
kind: ReplicaSet
metadata:    // ReplicationController 관련 설정
  name: 
  labels:
    app:
    type:
spec:
  template:   //pod 관련 설정
    metadata:
      name: 
      labels:
        app:
        type:
    spec:
      containers:
      - name:
        image:

replicas: 3
selector:
  matchLables:
    type:

 

# ReplicaSet 조회명령

kubectl get replicaset

 

# ReplicaSet 삭제명령 

kybectl delete replicaset my-rs

 

# ReplicaSet 재생성

kubectl create -f rs.yaml

 

# ReplicaSet YAML파일 수정 후 재반영

kubectl apply -f rs.yaml

 

# 현재 실행중인 ReplicaSet 수정

kubectl edit replicaset my-rs

 

#ReplicaSet의 Scale 설정

kubectl scale --replicas=5 -f rs.yaml

kubectl scale --replicas=5 <Type> <Name>

kubectl scale --replicas=5 replicaset my-rs

또는

kubectl edit replicaset my-rs 에서 replicas의 값을 수정

 

반응형

'IT Tech > Cloud Native' 카테고리의 다른 글

[CKA] Namespaces  (0) 2022.03.03
[CKA] Deployments  (0) 2022.03.03
[CKA] POD  (0) 2022.02.28
[CKA] Kube Proxy  (0) 2022.02.28
[CKA] Kubelet  (0) 2022.02.28