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|go-template-file|template‐
80       file|template|go-template|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       --httptest.serve=""
297           if non-empty, httptest.NewServer serves on this address and blocks
298
299
300       --insecure-skip-tls-verify=false
301           If true, the server's certificate will not be checked for validity.
302       This will make your HTTPS connections insecure
303
304
305       --kubeconfig=""
306           Path to the kubeconfig file to use for CLI requests.
307
308
309       --log-flush-frequency=0
310           Maximum number of seconds between log flushes
311
312
313       --log_backtrace_at=:0
314           when logging hits line file:N, emit a stack trace
315
316
317       --log_cadvisor_usage=false
318           Whether to log the usage of the cAdvisor container
319
320
321       --log_dir=""
322           If non-empty, write log files in this directory
323
324
325       --logtostderr=true
326           log to standard error instead of files
327
328
329       --machine_id_file="/etc/machine-id,/var/lib/dbus/machine-id"
330           Comma-separated  list  of  files  to  check for machine-id. Use the
331       first one that exists.
332
333
334       --match-server-version=false
335           Require server version to match client version
336
337
338       -n, --namespace=""
339           If present, the namespace scope for this CLI request
340
341
342       --request-timeout="0"
343           The length of time to wait before giving  up  on  a  single  server
344       request. Non-zero values should contain a corresponding time unit (e.g.
345       1s, 2m, 3h). A value of zero means don't timeout requests.
346
347
348       -s, --server=""
349           The address and port of the Kubernetes API server
350
351
352       --stderrthreshold=2
353           logs at or above this threshold go to stderr
354
355
356       --storage_driver_buffer_duration=0
357           Writes in the storage driver will be buffered  for  this  duration,
358       and committed to the non memory backends as a single transaction
359
360
361       --storage_driver_db="cadvisor"
362           database name
363
364
365       --storage_driver_host="localhost:8086"
366           database host:port
367
368
369       --storage_driver_password="root"
370           database password
371
372
373       --storage_driver_secure=false
374           use secure connection with database
375
376
377       --storage_driver_table="stats"
378           table name
379
380
381       --storage_driver_user="root"
382           database username
383
384
385       --token=""
386           Bearer token for authentication to the API server
387
388
389       --user=""
390           The name of the kubeconfig user to use
391
392
393       -v, --v=0
394           log level for V logs
395
396
397       --version=false
398           Print version information and quit
399
400
401       --vmodule=
402           comma-separated  list  of pattern=N settings for file-filtered log‐
403       ging
404
405
406

EXAMPLE

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

SEE ALSO

438       oc(1),
439
440
441

HISTORY

443       June 2016, Ported from the Kubernetes man-doc generator
444
445
446
447Openshift                  Openshift CLI User Manuals                    OC(1)
Impressum