K8s Labels and Annotations - philipf/notebook GitHub Wiki
Labels
Can be used in selectors
...
metadata:
name: my-production-label-pod
labels:
app: my-app
environment: production
...
kubectl get pods -l app=my-app
kubectl get pods -l environment=production
kubectl get pods -l environment=development
kubectl get pods -l environment!=production
kubectl get pods -l 'environment in (development,production)'
kubectl get pods -l app=my-app,environment=production
Annotations
Information only
...
metadata:
name: my-annotation-pod
annotations:
owner: [email protected]
git-commit: bdab0c6
...
Like labels, existing annotations can also be viewed using kubectl describe
.