본문 바로가기

CKA &. CKAD/Core Concepts

Practice Test - Replicaset/ReplicationController

ㅁ ReplicationController 정의

kubectl create -f rc-definition.yml
kubectl get replicationcontroller
kubectl get pod

 

ㅁ Replicaset 정의

 

kubectl create -f replicaset-definition.ymml
kubectl get replicaset
kubectl get pods

 

기존 Replicaset 3 --> 6으로 증가하는 방법

kubectl replace -f replicaset-definition.yml
kubectl scale --replicas=6 -f replicaset-definition.yml
kubectl scale --replicas=6 replicaset myapp-replicaset

 

Delete all underlying Pods

kubectl delete replicaset myapp-replicaset

 

Update replica set

kubectl replace -f replicaset-definition.yml

 

Scale replic set

kubectl scale -replicas=6 -f replicaset-definition.yml

 

[Practice Test]

 

ㅁ What is the image used to create the pod in the new-replica-set?

kubectl get rs new-replica-set -o wide
kubectl describe pod new-replica-set

ㅁ Image 수정 

kubectl edit rs new-replica-set

 

ㅁ Delete any one of the 4 PODs.

kubectl delete pod new-replica-set-dwhdt

 

ㅁ Why are there still 4 PODs, even after you deleted one?

-> ReplicaSet ensures that desired number of PODs always run

 

ㅁ Create a ReplicSet using the replicaset-definition-1.yaml file located at /root/.

There is an issue with the file, so try to fix it

apiVersion: v1 
--> 
apiVersion: apps/v1

 

ㅁ Fix the issue in the replicaset-definition-2.yaml files and create  ReplicaSet using it 

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: replicaset-2
spec:
  replicas: 2
  selector:
    matchLabels:
      tier: frontend  --> tier: nginx
  template:
    metadata:
      labels:
        tier: nginx
    spec:
      containers:
      - name: nginx
        image: nginx

ㅁ Fix the original replica set new-replica-set to use the correct busybox image

kubectl edit new-replica-set

kubectl delete pod ~~

 

ㅁ Scale the ReplicaSet to 5 Pods

kubectl edit rs new-replica-set

replicas: 4 --> 5로 수정

'CKA &. CKAD > Core Concepts' 카테고리의 다른 글

Practice Test - Deployment  (0) 2021.03.23
CKA Tip 1 (yaml)  (0) 2021.03.23
Practice Test - Core Concept  (0) 2021.03.22
ETCD-명령 (선택 사항)  (0) 2021.03.21
CKA 참고 자료  (0) 2021.03.21