mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 04:03:20 +00:00
Generate new docs with the new changes
This commit is contained in:
@@ -4,27 +4,32 @@ Update the labels on a resource
|
||||
|
||||
### Synopsis
|
||||
|
||||
```
|
||||
Update the labels on a resource.
|
||||
|
||||
If --overwrite is true, then existing labels can be overwritten, otherwise attempting to overwrite a label will result in an error.
|
||||
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.
|
||||
|
||||
Examples:
|
||||
// Update pod 'foo' with the label 'unhealthy' and the value 'true'.
|
||||
$ kubectl label pods foo unhealthy=true
|
||||
|
||||
// Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
|
||||
$ kubectl label --overwrite pods foo status=unhealthy
|
||||
|
||||
// Update pod 'foo' only if the resource is unchanged from version 1.
|
||||
$ kubectl label pods foo status=unhealthy --resource-version=1
|
||||
|
||||
// Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||
// Does not require the --overwrite flag.
|
||||
$ kubectl label pods foo bar-
|
||||
```
|
||||
|
||||
kubectl label [--overwrite] <resource> <name> <key-1>=<val-1> ... <key-n>=<val-n> [--resource-version=<version>]
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
// Update pod 'foo' with the label 'unhealthy' and the value 'true'.
|
||||
$ kubectl label pods foo unhealthy=true
|
||||
|
||||
// Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
|
||||
$ kubectl label --overwrite pods foo status=unhealthy
|
||||
|
||||
// Update pod 'foo' only if the resource is unchanged from version 1.
|
||||
$ kubectl label pods foo status=unhealthy --resource-version=1
|
||||
|
||||
// Update pod 'foo' by removing a label named 'bar' if it exists.
|
||||
// Does not require the --overwrite flag.
|
||||
$ kubectl label pods foo bar-
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user