728x90
반응형
annotation (어노테이션)
정의
- Label과 동일하게 key-value를 통해 리소스의 특성을 기록
- Kubernetes 에게 특정 정보 전달할 용도로 사용
- 예를 들어 Deployment의 rolling update 정보 기록
annotations: kubernetes.io/change-cause: version 1.15
- 관리를 위해 필요한 정보를 기록할 용도로 사용
- 릴리즈, 로깅, 모니터링에 필요한 정보들을 기록
annotations: builder: "홍길동" buildDate: "20211203" imageRegistry: https://hub.docker.com/
생성
root@master:~# cat > annotation.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-annotation
annotations:
builder: "Hong Gil Dong"
buildDate: "20211203"
imageRegistry: https://hub.docker.com
spec:
containers:
- name: nginx
image: nginx:1.14
ports:
- containerPort: 80
root@master:~# kubectl create -f annotation.yaml
pod/pod-annotation created
조회
describe로 조회해보면 Annotations 부분에 설정한 정보가 잘 기록되어있는 것을 볼 수 있다.
root@master:~# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod-annotation 1/1 Running 0 4s 10.36.0.1 node1.example.com <none> <none>
root@master:~# kubectl describe pod pod-annotation
Name: pod-annotation
Namespace: default
Priority: 0
Node: node1.example.com/10.100.0.101
Start Time: Thu, 02 Dec 2021 22:08:58 +0900
Labels: <none>
Annotations: buildDate: 20211203
builder: Hong Gil Dong
imageRegistry: https://hub.docker.com
Status: Running
IP: 10.36.0.1
IPs:
IP: 10.36.0.1
Containers:
nginx:
Container ID: docker://edaea5b3f2a90b7348c97bda459b771b62be02b9ed92afd16194d6adde986cea
Image: nginx:1.14
Image ID: docker-pullable://nginx@sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Thu, 02 Dec 2021 22:09:01 +0900
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-v7s6p (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-v7s6p:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 16s default-scheduler Successfully assigned default/pod-annotation to node1.example.com
Normal Pulled 6s kubelet Container image "nginx:1.14" already present on machine
Normal Created 6s kubelet Created container nginx
Normal Started 5s kubelet Started container nginx
728x90
반응형