1OC(1)                              June 2016                             OC(1)
2
3
4

NAME

6       oc expose - Expose a replicated application as a service or route
7
8
9

SYNOPSIS

11       oc expose [OPTIONS]
12
13
14

DESCRIPTION

16       Expose containers internally as services or externally via routes
17
18
19       There  is also the ability to expose a deployment configuration, repli‐
20       cation controller, service, or pod as a  new  service  on  a  specified
21       port. If no labels are specified, the new object will re-use the labels
22       from the object it exposes.
23
24
25

OPTIONS

27       --allow-missing-template-keys=true
28           If true, ignore any errors in templates when a field or map key  is
29       missing  in  the  template.  Only applies to golang and jsonpath output
30       formats.
31
32
33       --cluster-ip=""
34           ClusterIP to be assigned to the service. Leave empty to  auto-allo‐
35       cate, or set to 'None' to create a headless service.
36
37
38       --dry-run=false
39           If  true, only print the object that would be sent, without sending
40       it.
41
42
43       --external-ip=""
44           Additional external IP  address  (not  managed  by  Kubernetes)  to
45       accept for the service. If this IP is routed to a node, the service can
46       be accessed by this IP in addition to its generated service IP.
47
48
49       -f, --filename=[]
50           Filename, directory, or URL to files identifying  the  resource  to
51       expose a service
52
53
54       --generator=""
55           The  name  of  the  API  generator  to use. Defaults to "route/v1".
56       Available   generators   include   "service/v1",   "service/v2",    and
57       "route/v1".  "service/v1"  will  automatically name the port "default",
58       while "service/v2" will leave it unnamed.
59
60
61       --hostname=""
62           Set a hostname for the new route
63
64
65       -l, --labels=""
66           Labels to apply to the service created by this call.
67
68
69       --load-balancer-ip=""
70           IP to assign to the LoadBalancer. If empty, an ephemeral IP will be
71       created and used (cloud-provider specific).
72
73
74       --name=""
75           The name for the newly created object.
76
77
78       -o, --output=""
79           Output  format. One of: json|yaml|name|template|go-template|go-tem‐
80       plate-file|templatefile|jsonpath|jsonpath-file.
81
82
83       --overrides=""
84           An inline JSON override  for  the  generated  object.  If  this  is
85       non-empty,  it  is used to override the generated object. Requires that
86       the object supply a valid apiVersion field.
87
88
89       --path=""
90           Set a path for the new route
91
92
93       --port=""
94           The port that the resource should serve on.
95
96
97       --protocol=""
98           The network protocol for the service  to  be  created.  Default  is
99       'TCP'.
100
101
102       --record=false
103           Record  current  kubectl command in the resource annotation. If set
104       to false, do not record the command. If set to true,  record  the  com‐
105       mand.  If  not  set,  default to updating the existing annotation value
106       only if one already exists.
107
108
109       -R, --recursive=false
110           Process the directory used in -f,  --filename  recursively.  Useful
111       when  you  want  to  manage related manifests organized within the same
112       directory.
113
114
115       --save-config=false
116           If true, the configuration of current object will be saved  in  its
117       annotation.  Otherwise,  the annotation will be unchanged. This flag is
118       useful when you want to perform kubectl apply on  this  object  in  the
119       future.
120
121
122       --selector=""
123           A  label  selector  to  use  for  this service. Only equality-based
124       selector requirements are supported. If empty (the default)  infer  the
125       selector from the replication controller or replica set.)
126
127
128       --session-affinity=""
129           If  non-empty,  set  the  session affinity for the service to this;
130       legal values: 'None', 'ClientIP'
131
132
133       --target-port=""
134           Name or number for the port  on  the  container  that  the  service
135       should direct traffic to. Optional.
136
137
138       --template=""
139           Template  string  or  path  to template file to use when -o=go-tem‐
140       plate, -o=go-template-file. The template format is golang  templates  [
141http://golang.org/pkg/text/template/#pkg-overview⟩].
142
143
144       --type=""
145           Type for this service: ClusterIP, NodePort, LoadBalancer, or Exter‐
146       nalName. Default is 'ClusterIP'.
147
148
149       --wildcard-policy=""
150           Sets the WildcardPolicy for the hostname, the  default  is  "None".
151       Valid values are "None" and "Subdomain"
152
153
154

OPTIONS INHERITED FROM PARENT COMMANDS

156       --allow_verification_with_non_compliant_keys=false
157           Allow  a  SignatureVerifier  to  use  keys  which  are  technically
158       non-compliant with RFC6962.
159
160
161       --alsologtostderr=false
162           log to standard error as well as files
163
164
165       --application_metrics_count_limit=100
166           Max number of application metrics to store (per container)
167
168
169       --as=""
170           Username to impersonate for the operation
171
172
173       --as-group=[]
174           Group to impersonate for the operation, this flag can  be  repeated
175       to specify multiple groups.
176
177
178       --azure-container-registry-config=""
179           Path  to the file containing Azure container registry configuration
180       information.
181
182
183       --boot_id_file="/proc/sys/kernel/random/boot_id"
184           Comma-separated list of files to check for boot-id. Use  the  first
185       one that exists.
186
187
188       --cache-dir="/builddir/.kube/http-cache"
189           Default HTTP cache directory
190
191
192       --certificate-authority=""
193           Path to a cert file for the certificate authority
194
195
196       --client-certificate=""
197           Path to a client certificate file for TLS
198
199
200       --client-key=""
201           Path to a client key file for TLS
202
203
204       --cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
205           CIDRs opened in GCE firewall for LB traffic proxy  health checks
206
207
208       --cluster=""
209           The name of the kubeconfig cluster to use
210
211
212       --container_hints="/etc/cadvisor/container_hints.json"
213           location of the container hints file
214
215
216       --containerd="unix:///var/run/containerd.sock"
217           containerd endpoint
218
219
220       --context=""
221           The name of the kubeconfig context to use
222
223
224       --default-not-ready-toleration-seconds=300
225           Indicates   the   tolerationSeconds   of   the    toleration    for
226       notReady:NoExecute  that is added by default to every pod that does not
227       already have such a toleration.
228
229
230       --default-unreachable-toleration-seconds=300
231           Indicates the tolerationSeconds  of  the  toleration  for  unreach‐
232       able:NoExecute  that  is  added  by  default to every pod that does not
233       already have such a toleration.
234
235
236       --docker="unix:///var/run/docker.sock"
237           docker endpoint
238
239
240       --docker-tls=false
241           use TLS to connect to docker
242
243
244       --docker-tls-ca="ca.pem"
245           path to trusted CA
246
247
248       --docker-tls-cert="cert.pem"
249           path to client certificate
250
251
252       --docker-tls-key="key.pem"
253           path to private key
254
255
256       --docker_env_metadata_whitelist=""
257           a comma-separated list of environment variable keys that  needs  to
258       be collected for docker containers
259
260
261       --docker_only=false
262           Only report docker containers in addition to root stats
263
264
265       --docker_root="/var/lib/docker"
266           DEPRECATED:  docker  root is read from docker info (this is a fall‐
267       back, default: /var/lib/docker)
268
269
270       --enable_load_reader=false
271           Whether to enable cpu load reader
272
273
274       --event_storage_age_limit="default=24h"
275           Max length of time for which to store events (per type). Value is a
276       comma  separated  list  of  key  values, where the keys are event types
277       (e.g.: creation, oom) or "default" and the value is a duration. Default
278       is applied to all non-specified event types
279
280
281       --event_storage_event_limit="default=100000"
282           Max  number  of  events to store (per type). Value is a comma sepa‐
283       rated list of key values, where the keys are event  types  (e.g.:  cre‐
284       ation,  oom)  or  "default"  and  the  value  is an integer. Default is
285       applied to all non-specified event types
286
287
288       --global_housekeeping_interval=0
289           Interval between global housekeepings
290
291
292       --housekeeping_interval=0
293           Interval between container housekeepings
294
295
296       --insecure-skip-tls-verify=false
297           If true, the server's certificate will not be checked for validity.
298       This will make your HTTPS connections insecure
299
300
301       --kubeconfig=""
302           Path to the kubeconfig file to use for CLI requests.
303
304
305       --log-flush-frequency=0
306           Maximum number of seconds between log flushes
307
308
309       --log_backtrace_at=:0
310           when logging hits line file:N, emit a stack trace
311
312
313       --log_cadvisor_usage=false
314           Whether to log the usage of the cAdvisor container
315
316
317       --log_dir=""
318           If non-empty, write log files in this directory
319
320
321       --logtostderr=true
322           log to standard error instead of files
323
324
325       --machine_id_file="/etc/machine-id,/var/lib/dbus/machine-id"
326           Comma-separated  list  of  files  to  check for machine-id. Use the
327       first one that exists.
328
329
330       --match-server-version=false
331           Require server version to match client version
332
333
334       -n, --namespace=""
335           If present, the namespace scope for this CLI request
336
337
338       --request-timeout="0"
339           The length of time to wait before giving  up  on  a  single  server
340       request. Non-zero values should contain a corresponding time unit (e.g.
341       1s, 2m, 3h). A value of zero means don't timeout requests.
342
343
344       -s, --server=""
345           The address and port of the Kubernetes API server
346
347
348       --stderrthreshold=2
349           logs at or above this threshold go to stderr
350
351
352       --storage_driver_buffer_duration=0
353           Writes in the storage driver will be buffered  for  this  duration,
354       and committed to the non memory backends as a single transaction
355
356
357       --storage_driver_db="cadvisor"
358           database name
359
360
361       --storage_driver_host="localhost:8086"
362           database host:port
363
364
365       --storage_driver_password="root"
366           database password
367
368
369       --storage_driver_secure=false
370           use secure connection with database
371
372
373       --storage_driver_table="stats"
374           table name
375
376
377       --storage_driver_user="root"
378           database username
379
380
381       --token=""
382           Bearer token for authentication to the API server
383
384
385       --user=""
386           The name of the kubeconfig user to use
387
388
389       -v, --v=0
390           log level for V logs
391
392
393       --version=false
394           Print version information and quit
395
396
397       --vmodule=
398           comma-separated  list  of pattern=N settings for file-filtered log‐
399       ging
400
401
402

EXAMPLE

404                # Create a route based on service nginx. The new route will re-use nginx's labels
405                oc expose service nginx
406
407                # Create a route and specify your own label and route name
408                oc expose service nginx -l name=myroute --name=fromdowntown
409
410                # Create a route and specify a hostname
411                oc expose service nginx --hostname=www.example.com
412
413                # Create a route with wildcard
414                oc expose service nginx --hostname=x.example.com --wildcard-policy=Subdomain
415                This would be equivalent to *.example.com. NOTE: only hosts are matched by the wildcard, subdomains would not be included.
416
417                # Expose a deployment configuration as a service and use the specified port
418                oc expose dc ruby-hello-world --port=8080
419
420                # Expose a service as a route in the specified path
421                oc expose service nginx --path=/nginx
422
423                # Expose a service using different generators
424                oc expose service nginx --name=exposed-svc --port=12201 --protocol="TCP" --generator="service/v2"
425                oc expose service nginx --name=my-route --port=12201 --generator="route/v1"
426
427                Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "--name" provided
428                (or the name of the service otherwise). You may not specify a "--protocol" or "--target-port" option when using this generator.
429
430
431
432

SEE ALSO

434       oc(1),
435
436
437

HISTORY

439       June 2016, Ported from the Kubernetes man-doc generator
440
441
442
443Openshift                  Openshift CLI User Manuals                    OC(1)
Impressum