Udemy Labs - Certified Kubernetes Application Developer - Node Affinity 오답노트

hyereen·2025년 1월 24일

Kubernetes

목록 보기
15/53

3
Apply a label color=blue to node node01

정답
kubectl label node node01 color=blue

참고
-l 옵션은 -l 옵션 뒤에 오는 라벨을 가진 파드를 찾을때 쓰는 옵션

6

풀이

k create deployment blue --image=nginx --replicas=3
deployment.apps/blue created

k get deployments.apps blue -o yaml > 6.yaml

vi 6.yaml

spec.template.spec밑에 추가

      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: color
                operator: In
                values:
                - blue

0개의 댓글