최대 1 분 소요

Annotation

Label과 동일하게 key-value를 통해 리소스의 특성을 기술합니다

차이점은, annotation은 단지 정보 기록, 전달을 위한 용도로 사용됩니다.

예를들어 릴리즈, 로깅, 모니터링에 필요한 정보들을 기록합니다.

Annotation 예시

# pod-annotation.yaml

apiVersion: v1
kind: Pod
metadata:
  name: pod-annotation
  labels:
    app: nginx
  annotations:
    builder: "Jungik Kim (wjddlr0303@gmail.com)"
    buildDate: "20210812"
    imageRegistry: https://hub.docker.com/    
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80

Pod 생성 후 ,

kubectl describe pod pod-annotation 커맨드를 통해

Annotation 정보를 찾아볼 수 있습니다.

Name:         pod-annotation
Namespace:    default
Priority:     0
Node:         node01/172.17.0.24
Start Time:   Thu, 12 Aug 2021 08:26:00 +0000
Labels:       app=nginx
Annotations:  buildDate: 20210812
              builder: Jungik Kim (wjddlr0303@gmail.com)
              imageRegistry: https://hub.docker.com/
Status:       Running

댓글남기기