STUDY/Data Engineering

[kodekloud] 02 Scheduling : Node Affinity 풀이

wonpick 2023. 1. 23. 01:43
Q1. How many Labels exist on node node01?

 

Q2.What is the value set to the label key beta.kubernetes.io/arch on node01?

1번 명령어를 통해 value가 amd64임을 알 수 있음

beta.kubernetes.io/arch=amd64

 

Q3. Apply a label color=blue to node node01
 k label node node01 color=blue

 

Q4. Create a new deployment named blue with the nginx image and 3 replicas.
k create deployment blue --image=nginx --replicas=3

 

Q5. Which nodes can the pods for the blue deployment be placed on?

both of them

Q6. Set Node Affinity to the deployment to place the pods on node01 only.

드래그한 부분만 수정했을때는 왜 edited가 안되었는지

Q7. Which nodes are the pods placed on now?
k get pods -o wide

node01

Q8. Create a new deployment named red with the nginx image and 2 replicas, and ensure it gets placed on the controlplane node only. Use the label key - node-role.kubernetes.io/control-plane - which is already set on the controlplane node.
kubectl create deployment red --image=nginx --replicas=2 --dry-run=client -o yaml > deployment-red.yaml
vi deployment-red.yaml
k apply -f deployment-red.yaml