# Annotation
- Label과 동일하게 key-value를 통해 리소스의 특성 기록
- kubernetes에게 특정 정보 전달할 용도로 사용
- 예를 들어 Deployment의 Rolling update 정보 기록
- 관리를 위해 필요한 정보를 기록할 용도로 사용
- 릴리즈, 로깅, 모니터링에 필요한 정보들을 기록
[master ~]$cat annotation.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-annotation
annotations: # name과 같은 라인
builder: "Soyun Yoon (soyun3963@gmail.com)"
buildDate: "20240320"
imageRegistry: https://hub.docker.com/
spec:
containers:
- name: nginx
image: nginx:1.14
ports:
- containerPort: 80
[master ~]$kubectl create -f annotation.yaml
pod/pod-annotation created
[master ~]$kubectl get pods
NAME READY STATUS RESTARTS AGE
pod-annotation 1/1 Running 0 22s
# annotation 확인
[master ~]$kubectl describe pod pod-annotation
Name: pod-annotation
Namespace: default
Priority: 0
Service Account: default
Node: gke-cluster-1-default-pool-697aeef7-5nx7/10.128.0.12
Start Time: Wed, 20 Mar 2024 07:17:32 +0000
Labels: <none>
Annotations: buildDate: 20240320
builder: Soyun Yoon (soyun3963@gmail.com)
imageRegistry: https://hub.docker.com/
# Yaml 예시
[master ~]$cat deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-nginx
annotations:
kubernetes.io/change-cause: version 1.15 # 버전 업데이트
반응형
'Container > Kubernetes' 카테고리의 다른 글
[K8S] Secret (0) | 2024.03.20 |
---|---|
[K8S] Canary Deployment (0) | 2024.03.20 |
[K8S] Node Label & Selector (0) | 2024.03.17 |
[K8S] 쿠버네티스 레이블 (0) | 2024.03.17 |
[K8S] Ingress Controller (0) | 2024.03.07 |