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 --disable-compression=false If true, opt-out of response compres‐
126 sion for all requests to the server
127
128
129 --insecure-skip-tls-verify=false If true, the server's certificate
130 will not be checked for validity. This will make your HTTPS connections
131 insecure
132
133
134 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
135 quests.
136
137
138 --match-server-version=false Require server version to match
139 client version
140
141
142 -n, --namespace="" If present, the namespace scope for this CLI
143 request
144
145
146 --password="" Password for basic authentication to the API server
147
148
149 --profile="none" Name of profile to capture. One of
150 (none|cpu|heap|goroutine|threadcreate|block|mutex)
151
152
153 --profile-output="profile.pprof" Name of the file to write the
154 profile to
155
156
157 --request-timeout="0" The length of time to wait before giving up
158 on a single server request. Non-zero values should contain a corre‐
159 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
160 out requests.
161
162
163 -s, --server="" The address and port of the Kubernetes API server
164
165
166 --tls-server-name="" Server name to use for server certificate
167 validation. If it is not provided, the hostname used to contact the
168 server is used
169
170
171 --token="" Bearer token for authentication to the API server
172
173
174 --user="" The name of the kubeconfig user to use
175
176
177 --username="" Username for basic authentication to the API server
178
179
180 --version=false Print version information and quit
181
182
183 --warnings-as-errors=false Treat warnings received from the server
184 as errors and exit with a non-zero exit code
185
186
187
189 # Set the labels and selector before creating a deployment/service pair
190 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 -
191 kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
192
193
194
195
197 kubectl-set(1),
198
199
200
202 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
203 com) based on the kubernetes source material, but hopefully they have
204 been automatically generated since!
205
206
207
208Manuals User KUBERNETES(1)(kubernetes)