1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl set selector - Set the selector on a resource
10
11
12
14 kubectl set selector [OPTIONS]
15
16
17
19 Set the selector on a resource. Note that the new selector will over‐
20 write the old selector if the resource had one prior to the invocation
21 of 'set selector'.
22
23
24 A selector must begin with a letter or number, and may contain letters,
25 numbers, hyphens, dots, and underscores, up to 63 characters. If --re‐
26 source-version is specified, then updates will use this resource ver‐
27 sion, otherwise the existing resource-version will be used. Note: cur‐
28 rently selectors can only be set on Service objects.
29
30
31
33 --all=false Select all resources in the namespace of the specified
34 resource types
35
36
37 --allow-missing-template-keys=true If true, ignore any errors in
38 templates when a field or map key is missing in the template. Only ap‐
39 plies to golang and jsonpath output formats.
40
41
42 --dry-run="none" Must be "none", "server", or "client". If client
43 strategy, only print the object that would be sent, without sending it.
44 If server strategy, submit server-side request without persisting the
45 resource.
46
47
48 --field-manager="kubectl-set" Name of the manager used to track
49 field ownership.
50
51
52 -f, --filename=[] identifying the resource.
53
54
55 --local=false If true, annotation will NOT contact api-server but
56 run locally.
57
58
59 -o, --output="" Output format. One of: (json, yaml, name, go-tem‐
60 plate, go-template-file, template, templatefile, jsonpath, jsonpath-as-
61 json, jsonpath-file).
62
63
64 --record=false Record current kubectl command in the resource an‐
65 notation. If set to false, do not record the command. If set to true,
66 record the command. If not set, default to updating the existing anno‐
67 tation value only if one already exists.
68
69
70 -R, --recursive=true Process the directory used in -f, --filename
71 recursively. Useful when you want to manage related manifests organized
72 within the same directory.
73
74
75 --resource-version="" If non-empty, the selectors update will only
76 succeed if this is the current resource-version for the object. Only
77 valid when specifying a single resource.
78
79
80 --show-managed-fields=false If true, keep the managedFields when
81 printing objects in JSON or YAML format.
82
83
84 --template="" Template string or path to template file to use when
85 -o=go-template, -o=go-template-file. The template format is golang tem‐
86 plates [http://golang.org/pkg/text/template/#pkg-overview].
87
88
89
91 --as="" Username to impersonate for the operation. User could be a
92 regular user or a service account in a namespace.
93
94
95 --as-group=[] Group to impersonate for the operation, this flag
96 can be repeated to specify multiple groups.
97
98
99 --as-uid="" UID to impersonate for the operation.
100
101
102 --azure-container-registry-config="" Path to the file containing
103 Azure container registry configuration information.
104
105
106 --cache-dir="/builddir/.kube/cache" Default cache directory
107
108
109 --certificate-authority="" Path to a cert file for the certificate
110 authority
111
112
113 --client-certificate="" Path to a client certificate file for TLS
114
115
116 --client-key="" Path to a client key file for TLS
117
118
119 --cluster="" The name of the kubeconfig cluster to use
120
121
122 --context="" The name of the kubeconfig context to use
123
124
125 --insecure-skip-tls-verify=false If true, the server's certificate
126 will not be checked for validity. This will make your HTTPS connections
127 insecure
128
129
130 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
131 quests.
132
133
134 --match-server-version=false Require server version to match
135 client version
136
137
138 -n, --namespace="" If present, the namespace scope for this CLI
139 request
140
141
142 --password="" Password for basic authentication to the API server
143
144
145 --profile="none" Name of profile to capture. One of
146 (none|cpu|heap|goroutine|threadcreate|block|mutex)
147
148
149 --profile-output="profile.pprof" Name of the file to write the
150 profile to
151
152
153 --request-timeout="0" The length of time to wait before giving up
154 on a single server request. Non-zero values should contain a corre‐
155 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
156 out requests.
157
158
159 -s, --server="" The address and port of the Kubernetes API server
160
161
162 --tls-server-name="" Server name to use for server certificate
163 validation. If it is not provided, the hostname used to contact the
164 server is used
165
166
167 --token="" Bearer token for authentication to the API server
168
169
170 --user="" The name of the kubeconfig user to use
171
172
173 --username="" Username for basic authentication to the API server
174
175
176 --version=false Print version information and quit
177
178
179 --warnings-as-errors=false Treat warnings received from the server
180 as errors and exit with a non-zero exit code
181
182
183
185 # Set the labels and selector before creating a deployment/service pair
186 kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
187 kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
188
189
190
191
193 kubectl-set(1),
194
195
196
198 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
199 com) based on the kubernetes source material, but hopefully they have
200 been automatically generated since!
201
202
203
204Manuals User KUBERNETES(1)(kubernetes)