[Kubernetes] kubectl annotate command

기본 구조 #

1kubectl annotate [리소스 종류] [리소스 이름] [주석 이름]=[주석 값]
2
3# my-pod 이름의 Pod에 description="This is my pod" 주석을 추가할 수 있다.
4kubectl annotate pods my-pod description="This is my pod"

[명령어] --help를 입력하면 더 다양한 옵션들을 찾을 수 있다. {: .prompt-info }

Option #

  • --overwrite: 이미 존재하는 주석 값을 덮어쓰기 한다.

    1# my-pod 이름의 Pod에 이미 존재하는 description 주석 값을 This is my new pod으로 덮어쓴다.
    2kubectl annotate pods my-pod description="This is my new pod" --overwrite
  • --namespace: 리소스가 포함된 Namespace를 지정한다.

    1# my-namespace Namespace에 속한 my-pod 이름의 Pod에 description="This is my pod" 주석을 추가
    2kubectl annotate pods my-pod description="This is my pod" --namespace my-namespace

자주 쓰는 명령어는 kubectl-cheatsheet {: .prompt-info }

Advertisement