mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
30 lines
750 B
Plaintext
30 lines
750 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# kubectl label
|
|
|
|
> Label Kubernetes resources.
|
|
> More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_label>.
|
|
|
|
- Label a pod:
|
|
|
|
`kubectl label {{[po|pods]}} {{pod_name}} {{key}}={{value}}`
|
|
|
|
- Update a pod label by overwriting the existing value:
|
|
|
|
`kubectl label {{[po|pods]}} {{pod_name}} {{key}}={{value}} --overwrite`
|
|
|
|
- Label all pods in the namespace:
|
|
|
|
`kubectl label {{[po|pods]}} {{key}}={{value}} --all`
|
|
|
|
- Label a pod identified by the pod definition file:
|
|
|
|
`kubectl label {{[-f|--filename]}} {{pod_definition_file}} {{key}}={{value}}`
|
|
|
|
- Remove the label from a pod:
|
|
|
|
`kubectl label {{[po|pods]}} {{pod_name}} {{key}}-`
|