1. How many Labels exist on node node01?
# k describe nodes node01
A) 5
2.What is the value set to the label key beta.kubernetes.io/arch on node01?
# k describe nodes node01
: 위의 그림 참조
A) amd64
3. Apply a label color=blue to node node01
- color = blue
# k label nodes node01 color=blue
4. Create a new deployment named blue with the nginx image and 3 replicas.
# k create deployment blue --image=nginx --replicas=3
# k get deployments.apps
5.Which nodes can the pods for the blue deployment be placed on?
Make sure to check taints on both nodes!
# k describe nodes node01 | grep Taints
# k describe nodes controlplane | grep Taints
: 어떤 노드에 blue 파드를 deploy 시킬 수 있는지 ?
즉, Taints 가 <none> 인 노드를 찾는 문제
A) controlplane and node01
6. Set Node Affinity to the deployment to place the pods on node01 only.
-
Name: blue
-
Replicas: 3
-
Image: nginx
-
NodeAffinity: requiredDuringSchedulingIgnoredDuringExecution
-
Key: color
- value: blue
# k get deployment
# k edit deployment.apps blue
7. Which nodes are the pods placed on now?
A) node01
8.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/master - which is already set on the controlplane node.
-
Name: red
-
Replicas: 2
-
Image: nginx
-
NodeAffinity: requiredDuringSchedulingIgnoredDuringExecution
-
Key: node-role.kubernetes.io/master
- Use the right operator
# k create deployment red --image=nginx --replicase=2 --dry-run=client -o yaml > red.yaml
1) nginx 의 이미지로 만들고 replicase 적용된 yaml 파일을 만든다
2) label을 적용하기 위해 요건에 맞는 key 와 operator 을 작성한다.
* 유의사항
- docs 에서 찾아서 붙일때 띄어쓰기 반드시 조심하자 !
- 이거때문에 몇번 수정함... 반드시 두칸 띄기
'cloud > k8s(문제풀이)' 카테고리의 다른 글
[cka]kodekloud-DaemonSets (0) | 2022.06.09 |
---|---|
[cka]kodekloud-Resources Limit (0) | 2022.06.09 |
[cka]kodekloud-Taints & Tolerations (0) | 2022.06.08 |
[cka]kodekloud - Labels & selectors (0) | 2022.06.08 |
[cka] kodekloud-scheduling (0) | 2022.06.08 |