๋ ์ด๋ธ ํ์ธ
$ kubectl get pods --show-labels
$ kubectl get pods X -o yaml
$ kubectl describe pods X
๋ ์ด๋ธ ๊ด๋ฆฌ
$ kubectl label pods myweb APP=apache
$ kubectl label pods myweb ENV=developments
$ kubectl label pods myweb ENV=staging
$ kubectl label pods myweb ENV=staging --overwirte
$ kubectl label pods myweb ENV-
์ผ์น์ฑ(equality base)
===!=$ kubectl get pods -l APP=nginx
$ kubectl get pods -l APP==nginx
$ kubectl get pods -l 'APP!=nginx'
์งํฉ์ฑ(set base)
innotinexists: ํค๋ง ๋งค์นญkubectl get pods -l 'APP'doesnotexists: ํค ์ ์ธ ๋งค์นญkubectl get pods -l '!APP'๋ ์ด๋ธ๊ณผ ๋น์ท
๋น ์๋ณ ๋ฉํ๋ฐ์ดํ
๋ช ๋ นํ ์ปค๋งจ๋
$ kubectl annotate pods myweb created-by=luna
$ kubectl annotate pods myweb created-by=Kim --overwrite
$ kubectl annotate pods myweb created-by-
YAML
apiVersion: v1
kind: Pod
metadata:
name: myweb-label-anno
labels:
APP: apache
ENV: staging
annotations:
Created-by: Jang
spec:
containers:
- name: myweb
image: httpd
ports:
- containerPort: 80
protocol: TCP