이세개발
article thumbnail

쿠버네티스에서 주석(Annotation)은 사용자가 오브젝트에 부착하여 임의의 비-식별 정보를 저장하는 데 사용할 수 있는 키-값 쌍입니다. 주석은 레이블과 달리 식별 용도로 사용되지 않으며, 대신 오브젝트의 설명, 필드의 사용 방법 등의 정보를 저장하는 데 사용됩니다.

다음은 myapp-pod-annotation이라는 이름의 Pod를 생성하는 myapp-pod-annotation.yaml 파일입니다. 이 Pod에는 devops-team/developer: "John Smith"라는 주석이 부착되어 있습니다.

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod-annotation
  annotations: 
    devops-team/developer: "John Smith"
spec:
  containers:
  - name: myapp
    image: ghcr.io/c1t1d0s7/go-myweb:alpine
    ports:
    - containerPort: 8080
      protocol: TCP

주석을 추가하거나 변경하려면 kubectl annotate 명령어를 사용합니다:

  • Pod에 새 주석을 추가하려면 다음 명령어를 사용합니다:
  • kubectl annotate pod myapp-pod-annotation message=hello
  • Pod의 주석을 변경하려면 --overwrite 플래그를 사용합니다:
  • kubectl annotate pod myapp-pod-annotation message=world --overwrite
  • Pod의 주석을 제거하려면 주석 이름 뒤에 -를 붙입니다:
  • kubectl annotate pod myapp-pod-annotation message-

이렇게 주석을 사용하면 쿠버네티스 리소스에 대한 추가 정보를 저장하고 관리할 수 있습니다.

profile

이세개발

@print(name)

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!