Difference between revisions of "Kubernetes labels"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
(29 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | * <code>[[kubectl label]] pods -l app=LABEL new_label_tier=new_label_valuefe</code> | + | https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
+ | |||
+ | * <code>[[kubectl label]] pods -l [[app]]=LABEL new_label_tier=new_label_valuefe</code> | ||
* <code>[[kubectl label]] [[nodes]] <node-name> <label-key>=<label-value></code> | * <code>[[kubectl label]] [[nodes]] <node-name> <label-key>=<label-value></code> | ||
* <code>[[kubectl get nodes --show-labels]]</code> | * <code>[[kubectl get nodes --show-labels]]</code> | ||
+ | * <code>[[kubectl get pods --show-labels]]</code> | ||
+ | |||
+ | kubectl get pods -l environment=myproduction,tier=myfrontend | ||
+ | kubectl get pods -l 'environment in (myproduction, myqa)' | ||
+ | |||
+ | .../... | ||
+ | [[metadata:]] | ||
+ | [[labels:]] | ||
+ | .../... | ||
+ | |||
+ | [[kubectl describe pod my-release-kubernetes-dashboard]] | ||
+ | .../... | ||
+ | Labels: [[app.kubernetes.io]]/component=kubernetes-dashboard | ||
+ | app.kubernetes.io/instance=my-release | ||
+ | app.kubernetes.io/managed-by=Helm | ||
+ | app.kubernetes.io/name=kubernetes-dashboard | ||
+ | app.kubernetes.io/version=2.4.0 | ||
+ | [[helm.sh]]/chart=kubernetes-dashboard-5.0.4 | ||
+ | pod-template-hash=b8c4f9c87 | ||
+ | .../... | ||
+ | |||
+ | |||
+ | labels: | ||
+ | [[addonmanager.kubernetes.io]]/mode: EnsureExists | ||
+ | |||
+ | |||
+ | * [[Kubernetes Canary Deployments]]: <code>[[track:]] [ stable | [[canary]] ]</code> | ||
== Activities == | == Activities == | ||
+ | * [[CKA v1.15]], [[CKA v1.21: Understand how to use Labels, Selector and Annotations]] | ||
* [[CKA v1.18]]: Use [[label]] selectors to [[schedule Pods]] | * [[CKA v1.18]]: Use [[label]] selectors to [[schedule Pods]] | ||
− | * [[ | + | * Read [[recommended labels]]: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ |
+ | |||
+ | == Related == | ||
+ | * <code>[[kubectl label]]</code> | ||
+ | * <code>[[kubectl annotate]]</code> | ||
+ | * <code>[[kubectl describe configmaps]]</code> | ||
+ | * [[Kubernetes selectors]]: <code>[[selector:]]</code> | ||
+ | * [[eks.amazonaws.com/compute-type: fargate]] | ||
+ | * [[kind: Deployment]] | ||
+ | * [[Docker compose]] labels | ||
== See also == | == See also == | ||
+ | * {{kubectl label}} | ||
* {{Kubernetes labels}} | * {{Kubernetes labels}} | ||
[[Category:Kubernetes]] | [[Category:Kubernetes]] | ||
[[Category:CKAD]] | [[Category:CKAD]] |
Latest revision as of 17:37, 15 February 2024
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
kubectl label pods -l app=LABEL new_label_tier=new_label_valuefe
kubectl label nodes <node-name> <label-key>=<label-value>
kubectl get pods -l environment=myproduction,tier=myfrontend kubectl get pods -l 'environment in (myproduction, myqa)'
.../... metadata: labels: .../...
kubectl describe pod my-release-kubernetes-dashboard .../... Labels: app.kubernetes.io/component=kubernetes-dashboard app.kubernetes.io/instance=my-release app.kubernetes.io/managed-by=Helm app.kubernetes.io/name=kubernetes-dashboard app.kubernetes.io/version=2.4.0 helm.sh/chart=kubernetes-dashboard-5.0.4 pod-template-hash=b8c4f9c87 .../...
labels: addonmanager.kubernetes.io/mode: EnsureExists
- Kubernetes Canary Deployments:
track: [ stable | canary ]
Activities[edit]
- CKA v1.15, CKA v1.21: Understand how to use Labels, Selector and Annotations
- CKA v1.18: Use label selectors to schedule Pods
- Read recommended labels: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
Related[edit]
kubectl label
kubectl annotate
kubectl describe configmaps
- Kubernetes selectors:
selector:
- eks.amazonaws.com/compute-type: fargate
- kind: Deployment
- Docker compose labels
See also[edit]
Advertising: