Difference between revisions of "Kubectl label"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
Tags: Mobile web edit, Mobile edit |
||
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
<code>kubectl label</code> Update labels on resources ([https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#label k8.io]) | <code>kubectl label</code> Update labels on resources ([https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#label k8.io]) | ||
+ | == Commands == | ||
[[kubectl label --help]] | [[kubectl label --help]] | ||
[[kubectl]] label [[pods]] my-pod new-label=awesome_label | [[kubectl]] label [[pods]] my-pod new-label=awesome_label | ||
kubectl label [[nodes]] <node-name> <label-key>=<label-value> | kubectl label [[nodes]] <node-name> <label-key>=<label-value> | ||
+ | kubectl label [[namespace]] default [[istio]]-injection=enabled | ||
+ | |||
+ | == Examples == | ||
+ | kubectl label [[namespace]] default [[istio]]-injection=enabled | ||
+ | namespace/default labeled | ||
+ | Related: [[Install Istio]] | ||
+ | == Errors == | ||
kubectl label | kubectl label | ||
error: one or more resources must be specified as <resource> <name> or <resource>/<name> | error: one or more resources must be specified as <resource> <name> or <resource>/<name> | ||
− | |||
− | |||
− | |||
== Related terms == | == Related terms == |
Revision as of 06:26, 16 March 2023
kubectl label
Update labels on resources (k8.io)
Commands
kubectl label --help kubectl label pods my-pod new-label=awesome_label kubectl label nodes <node-name> <label-key>=<label-value> kubectl label namespace default istio-injection=enabled
Examples
kubectl label namespace default istio-injection=enabled namespace/default labeled Related: Install Istio
Errors
kubectl label error: one or more resources must be specified as <resource> <name> or <resource>/<name>
Related terms
kubectl annotate
kubectl get nodes --show-labels
kubectl get pods --show-labels
eks.amazonaws.com/compute-type: fargate
Activities
- CKA v1.18: Use label selectors to schedule Pods
- CKA v1.15: Understand how to use Labels, Selector and Annotations
- Assign Pods to Nodes using Node Affinity
See also
Advertising: