[Kubernetes] 명령어

grin·2023년 3월 20일

손가락과 머리가 기억하고 있지만 반영할때마다 두려움과 걱정이 많은게 쿠버네티스 명령어같다.
그럴때마다 구글링과 Docs의 도움을 받지만 항상 새로운 창을 키다보니 크롬창이 너무 많아져서 이럴바엔 한곳에 모아두자라는 마음으로 ..! 작성해둡니다.

🏄‍♂️ k8s Node label

쿠버네티스 클러스터 내부에 객체를 생성할 때, 해당 객체를 구분하기 위해서는 label을 이용한다.

  • 노드 레이블
kubectl label nodes [node명] key=value
ex) kubectl label nodes worker1 message=prod
  • 노드 디레이블
kubectl label nodes [node명] key-
  • 레이블 확인
kubectl get nodes --show-labels | grep [label명]
kubectl describe nodes [node명] | grep [label명]

🚌 k8s Node taint, Pod toleration

Node라는 집에 taint라는 자물쇠를 채운다.
Pod는 Node안으로 들어가기 위해 toleration이라는 열쇠를 품는다.
라고 처음에 인식한게 아직도 남아있다🤣.

  • Node taint, taint 제거
kubectl taint nodes node1 key1=value1:NoSchedule
ex) kubectl taint nodes worker1 message=prod:NoSchedule

kubectl taint nodes node1 key1=value1:NoSchedule-
ex) kubectl taint nodes worker1 message=prod:NoSchedule-
  • Pod toleration
tolerations:
- key: "key1"
  operator: "Equal"
  value: "value1"
  effect: "NoSchedule"
profile
성장하는중

0개의 댓글