Browse code

Update generated docs

Fabiano Franz authored on 2016/09/27 07:49:21
Showing 2 changed files
... ...
@@ -4,506 +4,823 @@
4 4
 toc::[]
5 5
 
6 6
 
7
-== <no value>
8
-<no value>
7
+== oadm build-chain
8
+Output the inputs and dependencies of your builds
9 9
 
10 10
 ====
11 11
 
12 12
 [options="nowrap"]
13 13
 ----
14
-<no value>
14
+  # Build the dependency tree for the 'latest' tag in <image-stream>
15
+  oadm build-chain <image-stream>
16
+
17
+  # Build the dependency tree for 'v2' tag in dot format and visualize it via the dot utility
18
+  oadm build-chain <image-stream>:v2 -o dot | dot -T svg -o deps.svg
19
+
20
+  # Build the dependency tree across all namespaces for the specified image stream tag found in 'test' namespace
21
+  oadm build-chain <image-stream> -n test --all
15 22
 ----
16 23
 ====
17 24
 
18 25
 
19
-== <no value>
20
-<no value>
26
+== oadm ca decrypt
27
+Decrypt data encrypted with "oadm ca encrypt"
21 28
 
22 29
 ====
23 30
 
24 31
 [options="nowrap"]
25 32
 ----
26
-<no value>
33
+	# Decrypt an encrypted file to a cleartext file:
34
+	oadm ca decrypt --key=secret.key --in=secret.encrypted --out=secret.decrypted
35
+	
36
+	# Decrypt from stdin to stdout:
37
+	oadm ca decrypt --key=secret.key < secret2.encrypted > secret2.decrypted
38
+
27 39
 ----
28 40
 ====
29 41
 
30 42
 
31
-== <no value>
32
-<no value>
43
+== oadm ca encrypt
44
+Encrypt data with AES-256-CBC encryption
33 45
 
34 46
 ====
35 47
 
36 48
 [options="nowrap"]
37 49
 ----
38
-<no value>
50
+	# Encrypt the content of secret.txt with a generated key:
51
+	oadm ca encrypt --genkey=secret.key --in=secret.txt --out=secret.encrypted
52
+	
53
+	# Encrypt the content of secret2.txt with an existing key:
54
+	oadm ca encrypt --key=secret.key < secret2.txt > secret2.encrypted
55
+
39 56
 ----
40 57
 ====
41 58
 
42 59
 
43
-== <no value>
44
-<no value>
60
+== oadm completion
61
+Output shell completion code for the given shell (bash or zsh)
45 62
 
46 63
 ====
47 64
 
48 65
 [options="nowrap"]
49 66
 ----
50
-<no value>
67
+  # Generate the oadm completion code for bash
68
+  oadm completion bash > bash_completion.sh
69
+  source bash_completion.sh
70
+
71
+  # The above example depends on the bash-completion framework.
72
+  It must be sourced before sourcing the openshift cli completion, i.e. on the Mac:
73
+
74
+  brew install bash-completion
75
+  source $(brew --prefix)/etc/bash_completion
76
+  oadm completion bash > bash_completion.sh
77
+  source bash_completion.sh
78
+
79
+  # In zsh*, the following will load openshift cli zsh completion:
80
+  source <(oadm completion zsh)
81
+
82
+  * zsh completions are only supported in versions of zsh >= 5.2
51 83
 ----
52 84
 ====
53 85
 
54 86
 
55
-== <no value>
56
-<no value>
87
+== oadm config
88
+Change configuration files for the client
57 89
 
58 90
 ====
59 91
 
60 92
 [options="nowrap"]
61 93
 ----
62
-<no value>
94
+  # Change the config context to use
95
+  oadm config use-context my-context
96
+  
97
+  # Set the value of a config preference
98
+  oadm config set preferences.some true
63 99
 ----
64 100
 ====
65 101
 
66 102
 
67
-== <no value>
68
-<no value>
103
+== oadm config current-context
104
+Displays the current-context
69 105
 
70 106
 ====
71 107
 
72 108
 [options="nowrap"]
73 109
 ----
74
-<no value>
110
+  
111
+  # Display the current-context
112
+  oadm config current-context
75 113
 ----
76 114
 ====
77 115
 
78 116
 
79
-== <no value>
80
-<no value>
117
+== oadm config get-contexts
118
+Describe one or many contexts
81 119
 
82 120
 ====
83 121
 
84 122
 [options="nowrap"]
85 123
 ----
86
-<no value>
124
+  # List all the contexts in your kubeconfig file
125
+  oadm config get-contexts
126
+  
127
+  # Describe one context in your kubeconfig file.
128
+  oadm config get-contexts my-context
87 129
 ----
88 130
 ====
89 131
 
90 132
 
91
-== <no value>
92
-<no value>
133
+== oadm config set-cluster
134
+Sets a cluster entry in kubeconfig
93 135
 
94 136
 ====
95 137
 
96 138
 [options="nowrap"]
97 139
 ----
98
-<no value>
140
+  
141
+  # Set only the server field on the e2e cluster entry without touching other values.
142
+  oadm config set-cluster e2e --server=https://1.2.3.4
143
+  
144
+  # Embed certificate authority data for the e2e cluster entry
145
+  oadm config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
146
+  
147
+  # Disable cert checking for the dev cluster entry
148
+  oadm config set-cluster e2e --insecure-skip-tls-verify=true
99 149
 ----
100 150
 ====
101 151
 
102 152
 
103
-== <no value>
104
-<no value>
153
+== oadm config set-context
154
+Sets a context entry in kubeconfig
105 155
 
106 156
 ====
107 157
 
108 158
 [options="nowrap"]
109 159
 ----
110
-<no value>
160
+  
161
+  # Set the user field on the gce context entry without touching other values
162
+  oadm config set-context gce --user=cluster-admin
111 163
 ----
112 164
 ====
113 165
 
114 166
 
115
-== <no value>
116
-<no value>
167
+== oadm config set-credentials
168
+Sets a user entry in kubeconfig
117 169
 
118 170
 ====
119 171
 
120 172
 [options="nowrap"]
121 173
 ----
122
-<no value>
174
+  
175
+  # Set only the "client-key" field on the "cluster-admin"
176
+  # entry, without touching other values:
177
+  oadm config set-credentials cluster-admin --client-key=~/.kube/admin.key
178
+  
179
+  # Set basic auth for the "cluster-admin" entry
180
+  oadm config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
181
+  
182
+  # Embed client certificate data in the "cluster-admin" entry
183
+  oadm config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
184
+  
185
+  # Enable the Google Compute Platform auth provider for the "cluster-admin" entry
186
+  oadm config set-credentials cluster-admin --auth-provider=gcp
187
+  
188
+  # Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional args
189
+  oadm config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
190
+  
191
+  # Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
192
+  oadm config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
123 193
 ----
124 194
 ====
125 195
 
126 196
 
127
-== <no value>
128
-<no value>
197
+== oadm config view
198
+Display merged kubeconfig settings or a specified kubeconfig file
129 199
 
130 200
 ====
131 201
 
132 202
 [options="nowrap"]
133 203
 ----
134
-<no value>
204
+  
205
+  # Show Merged kubeconfig settings.
206
+  oadm config view
207
+  
208
+  # Get the password for the e2e user
209
+  oadm config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
135 210
 ----
136 211
 ====
137 212
 
138 213
 
139
-== <no value>
140
-<no value>
214
+== oadm cordon
215
+Mark node as unschedulable
141 216
 
142 217
 ====
143 218
 
144 219
 [options="nowrap"]
145 220
 ----
146
-<no value>
221
+
222
+# Mark node "foo" as unschedulable.
223
+oadm cordon foo
224
+
147 225
 ----
148 226
 ====
149 227
 
150 228
 
151
-== <no value>
152
-<no value>
229
+== oadm drain
230
+Drain node in preparation for maintenance
153 231
 
154 232
 ====
155 233
 
156 234
 [options="nowrap"]
157 235
 ----
158
-<no value>
236
+
237
+# Drain node "foo", even if there are pods not managed by a ReplicationController, ReplicaSet, Job, or DaemonSet on it.
238
+$ oadm drain foo --force
239
+
240
+# As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, or DaemonSet, and use a grace period of 15 minutes.
241
+$ oadm drain foo --grace-period=900
242
+
159 243
 ----
160 244
 ====
161 245
 
162 246
 
163
-== <no value>
164
-<no value>
247
+== oadm groups add-users
248
+Add users to a group
165 249
 
166 250
 ====
167 251
 
168 252
 [options="nowrap"]
169 253
 ----
170
-<no value>
254
+  # Add user1 and user2 to my-group
255
+  oadm groups add-users my-group user1 user2
171 256
 ----
172 257
 ====
173 258
 
174 259
 
175
-== <no value>
176
-<no value>
260
+== oadm groups new
261
+Create a new group
177 262
 
178 263
 ====
179 264
 
180 265
 [options="nowrap"]
181 266
 ----
182
-<no value>
267
+  # Add a group with no users
268
+  oadm groups new my-group
269
+
270
+  # Add a group with two users
271
+  oadm groups new my-group user1 user2
272
+
273
+  # Add a group with one user and shorter output
274
+  oadm groups new my-group user1 -o name
183 275
 ----
184 276
 ====
185 277
 
186 278
 
187
-== <no value>
188
-<no value>
279
+== oadm groups prune
280
+Prune OpenShift groups referencing missing records on an external provider.
189 281
 
190 282
 ====
191 283
 
192 284
 [options="nowrap"]
193 285
 ----
194
-<no value>
286
+  # Prune all orphaned groups
287
+  oadm groups prune --sync-config=/path/to/ldap-sync-config.yaml --confirm
288
+
289
+  # Prune all orphaned groups except the ones from the blacklist file
290
+  oadm groups prune --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
291
+
292
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist file
293
+  oadm groups prune --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
294
+
295
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist
296
+  oadm groups prune groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
297
+
195 298
 ----
196 299
 ====
197 300
 
198 301
 
199
-== <no value>
200
-<no value>
302
+== oadm groups remove-users
303
+Remove users from a group
201 304
 
202 305
 ====
203 306
 
204 307
 [options="nowrap"]
205 308
 ----
206
-<no value>
309
+  # Remove user1 and user2 from my-group
310
+  oadm groups remove-users my-group user1 user2
207 311
 ----
208 312
 ====
209 313
 
210 314
 
211
-== <no value>
212
-<no value>
315
+== oadm groups sync
316
+Sync OpenShift groups with records from an external provider.
213 317
 
214 318
 ====
215 319
 
216 320
 [options="nowrap"]
217 321
 ----
218
-<no value>
322
+  # Sync all groups from an LDAP server
323
+  oadm groups sync --sync-config=/path/to/ldap-sync-config.yaml --confirm
324
+
325
+  # Sync all groups except the ones from the blacklist file from an LDAP server
326
+  oadm groups sync --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
327
+
328
+  # Sync specific groups specified in a whitelist file with an LDAP server
329
+  oadm groups sync --whitelist=/path/to/whitelist.txt --sync-config=/path/to/sync-config.yaml --confirm
330
+
331
+  # Sync all OpenShift Groups that have been synced previously with an LDAP server
332
+  oadm groups sync --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm
333
+
334
+  # Sync specific OpenShift Groups if they have been synced previously with an LDAP server
335
+  oadm groups sync groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm
336
+
219 337
 ----
220 338
 ====
221 339
 
222 340
 
223
-== <no value>
224
-<no value>
341
+== oadm ipfailover
342
+Install an IP failover group to a set of nodes
225 343
 
226 344
 ====
227 345
 
228 346
 [options="nowrap"]
229 347
 ----
230
-<no value>
348
+  # Check the default IP failover configuration ("ipfailover"):
349
+  oadm ipfailover
350
+
351
+  # See what the IP failover configuration would look like if it is created:
352
+  oadm ipfailover -o json
353
+
354
+  # Create an IP failover configuration if it does not already exist:
355
+  oadm ipfailover ipf --virtual-ips="10.1.1.1-4" --create
356
+
357
+  # Create an IP failover configuration on a selection of nodes labeled
358
+  # "router=us-west-ha" (on 4 nodes with 7 virtual IPs monitoring a service
359
+  # listening on port 80, such as the router process).
360
+  oadm ipfailover ipfailover --selector="router=us-west-ha" --virtual-ips="1.2.3.4,10.1.1.100-104,5.6.7.8" --watch-port=80 --replicas=4 --create
361
+
362
+  # Use a different IP failover config image and see the configuration:
363
+  oadm ipfailover ipf-alt --selector="hagroup=us-west-ha" --virtual-ips="1.2.3.4" -o yaml --images=myrepo/myipfailover:mytag
231 364
 ----
232 365
 ====
233 366
 
234 367
 
235
-== <no value>
236
-<no value>
368
+== oadm manage-node
369
+Manage nodes - list pods, evacuate, or mark ready
237 370
 
238 371
 ====
239 372
 
240 373
 [options="nowrap"]
241 374
 ----
242
-<no value>
375
+	# Block accepting any pods on given nodes
376
+	oadm manage-node <mynode> --schedulable=false
377
+
378
+	# Mark selected nodes as schedulable
379
+	oadm manage-node --selector="<env=dev>" --schedulable=true
380
+
381
+	# Migrate selected pods
382
+	oadm manage-node <mynode> --evacuate --pod-selector="<service=myapp>"
383
+
384
+	# Migrate selected pods, use a grace period of 60 seconds
385
+	oadm manage-node <mynode> --evacuate --grace-period=60 --pod-selector="<service=myapp>"
386
+
387
+	# Migrate selected pods not backed by replication controller
388
+	oadm manage-node <mynode> --evacuate --force --pod-selector="<service=myapp>"
389
+
390
+	# Show pods that will be migrated
391
+	oadm manage-node <mynode> --evacuate --dry-run --pod-selector="<service=myapp>"
392
+
393
+	# List all pods on given nodes
394
+	oadm manage-node <mynode1> <mynode2> --list-pods
243 395
 ----
244 396
 ====
245 397
 
246 398
 
247
-== <no value>
248
-<no value>
399
+== oadm migrate image-references
400
+Update embedded Docker image references
249 401
 
250 402
 ====
251 403
 
252 404
 [options="nowrap"]
253 405
 ----
254
-<no value>
406
+  # Perform a dry-run of migrating all "docker.io" references to "myregistry.com"
407
+  oadm migrate image-references docker.io/*=myregistry.com/*
408
+
409
+  # To actually perform the migration, the confirm flag must be appended
410
+  oadm migrate image-references docker.io/*=myregistry.com/* --confirm
411
+
412
+  # To see more details of what will be migrated, use the loglevel and output flags
413
+  oadm migrate image-references docker.io/*=myregistry.com/* --loglevel=2 -o yaml
414
+
415
+  # Migrate from a service IP to an internal service DNS name
416
+  oadm migrate image-references 172.30.1.54/*=registry.openshift.svc.cluster.local/*
417
+
418
+  # Migrate from a service IP to an internal service DNS name for all deployment configs and builds
419
+  oadm migrate image-references 172.30.1.54/*=registry.openshift.svc.cluster.local/* --include=buildconfigs,deploymentconfigs
255 420
 ----
256 421
 ====
257 422
 
258 423
 
259
-== <no value>
260
-<no value>
424
+== oadm migrate storage
425
+Update the stored version of API objects
261 426
 
262 427
 ====
263 428
 
264 429
 [options="nowrap"]
265 430
 ----
266
-<no value>
431
+  # Perform a dry-run of updating all objects
432
+  oadm migrate storage
433
+
434
+  # To actually perform the update, the confirm flag must be appended
435
+  oadm migrate storage --confirm
436
+
437
+  # Only migrate pods
438
+  oadm migrate storage --include=pods --confirm
439
+
440
+  # Only pods that are in namespaces starting with "bar"
441
+  oadm migrate storage --include=pods --confirm --from-key=bar/ --to-key=bar/\xFF
442
+
267 443
 ----
268 444
 ====
269 445
 
270 446
 
271
-== <no value>
272
-<no value>
447
+== oadm pod-network isolate-projects
448
+Isolate project network
273 449
 
274 450
 ====
275 451
 
276 452
 [options="nowrap"]
277 453
 ----
278
-<no value>
454
+	# Provide isolation for project p1
455
+	oadm pod-network isolate-projects <p1>
456
+
457
+	# Allow all projects with label name=top-secret to have their own isolated project network
458
+	oadm pod-network isolate-projects --selector='name=top-secret'
279 459
 ----
280 460
 ====
281 461
 
282 462
 
283
-== <no value>
284
-<no value>
463
+== oadm pod-network join-projects
464
+Join project network
285 465
 
286 466
 ====
287 467
 
288 468
 [options="nowrap"]
289 469
 ----
290
-<no value>
470
+	# Allow project p2 to use project p1 network
471
+	oadm pod-network join-projects --to=<p1> <p2>
472
+
473
+	# Allow all projects with label name=top-secret to use project p1 network
474
+	oadm pod-network join-projects --to=<p1> --selector='name=top-secret'
291 475
 ----
292 476
 ====
293 477
 
294 478
 
295
-== <no value>
296
-<no value>
479
+== oadm pod-network make-projects-global
480
+Make project network global
297 481
 
298 482
 ====
299 483
 
300 484
 [options="nowrap"]
301 485
 ----
302
-<no value>
486
+	# Allow project p1 to access all pods in the cluster and vice versa
487
+	oadm pod-network make-projects-global <p1>
488
+
489
+	# Allow all projects with label name=share to access all pods in the cluster and vice versa
490
+	oadm pod-network make-projects-global --selector='name=share'
303 491
 ----
304 492
 ====
305 493
 
306 494
 
307
-== <no value>
308
-<no value>
495
+== oadm policy add-role-to-user
496
+Add a role to users or serviceaccounts for the current project
309 497
 
310 498
 ====
311 499
 
312 500
 [options="nowrap"]
313 501
 ----
314
-<no value>
502
+  # Add the 'view' role to user1 for the current project
503
+  oadm policy add-role-to-user view user1
504
+
505
+  # Add the 'edit' role to serviceaccount1 for the current project
506
+  oadm policy add-role-to-user edit -z serviceaccount1
315 507
 ----
316 508
 ====
317 509
 
318 510
 
319
-== <no value>
320
-<no value>
511
+== oadm policy add-scc-to-user
512
+Add users or serviceaccount to a security context constraint
321 513
 
322 514
 ====
323 515
 
324 516
 [options="nowrap"]
325 517
 ----
326
-<no value>
518
+  # Add the 'restricted' security context contraint to user1 and user2
519
+  oadm policy add-scc-to-user restricted user1 user2
520
+
521
+  # Add the 'privileged' security context contraint to the service account serviceaccount1 in the current namespace
522
+  oadm policy add-scc-to-user privileged -z serviceaccount1
327 523
 ----
328 524
 ====
329 525
 
330 526
 
331
-== <no value>
332
-<no value>
527
+== oadm policy reconcile-cluster-role-bindings
528
+Update cluster role bindings to match the recommended bootstrap policy
333 529
 
334 530
 ====
335 531
 
336 532
 [options="nowrap"]
337 533
 ----
338
-<no value>
534
+  # Display the names of cluster role bindings that would be modified
535
+  oadm policy reconcile-cluster-role-bindings -o name
536
+
537
+  # Display the cluster role bindings that would be modified, removing any extra subjects
538
+  oadm policy reconcile-cluster-role-bindings --additive-only=false
539
+
540
+  # Update cluster role bindings that don't match the current defaults
541
+  oadm policy reconcile-cluster-role-bindings --confirm
542
+
543
+  # Update cluster role bindings that don't match the current defaults, avoid adding roles to the system:authenticated group
544
+  oadm policy reconcile-cluster-role-bindings --confirm --exclude-groups=system:authenticated
545
+
546
+  # Update cluster role bindings that don't match the current defaults, removing any extra subjects from the binding
547
+  oadm policy reconcile-cluster-role-bindings --confirm --additive-only=false
339 548
 ----
340 549
 ====
341 550
 
342 551
 
343
-== <no value>
344
-<no value>
552
+== oadm policy reconcile-cluster-roles
553
+Update cluster roles to match the recommended bootstrap policy
345 554
 
346 555
 ====
347 556
 
348 557
 [options="nowrap"]
349 558
 ----
350
-<no value>
559
+  # Display the names of cluster roles that would be modified
560
+  oadm policy reconcile-cluster-roles -o name
561
+
562
+  # Add missing permissions to cluster roles that don't match the current defaults
563
+  oadm policy reconcile-cluster-roles --confirm
564
+
565
+  # Add missing permissions and remove extra permissions from
566
+  # cluster roles that don't match the current defaults
567
+  oadm policy reconcile-cluster-roles --additive-only=false --confirm
568
+
569
+  # Display the union of the default and modified cluster roles
570
+  oadm policy reconcile-cluster-roles --additive-only
351 571
 ----
352 572
 ====
353 573
 
354 574
 
355
-== <no value>
356
-<no value>
575
+== oadm policy reconcile-sccs
576
+Replace cluster SCCs to match the recommended bootstrap policy
357 577
 
358 578
 ====
359 579
 
360 580
 [options="nowrap"]
361 581
 ----
362
-<no value>
582
+  # Display the cluster SCCs that would be modified
583
+  oadm policy reconcile-sccs
584
+
585
+  # Update cluster SCCs that don't match the current defaults preserving additional grants
586
+  # for users and group and keeping any priorities that are already set
587
+  oadm policy reconcile-sccs --confirm
588
+
589
+  # Replace existing users, groups, and priorities that do not match defaults
590
+  oadm policy reconcile-sccs --additive-only=false --confirm
363 591
 ----
364 592
 ====
365 593
 
366 594
 
367
-== <no value>
368
-<no value>
595
+== oadm prune builds
596
+Remove old completed and failed builds
369 597
 
370 598
 ====
371 599
 
372 600
 [options="nowrap"]
373 601
 ----
374
-<no value>
602
+  # Dry run deleting older completed and failed builds and also including
603
+  # all builds whose associated BuildConfig no longer exists
604
+  oadm prune builds --orphans
605
+
606
+  # To actually perform the prune operation, the confirm flag must be appended
607
+  oadm prune builds --orphans --confirm
375 608
 ----
376 609
 ====
377 610
 
378 611
 
379
-== <no value>
380
-<no value>
612
+== oadm prune deployments
613
+Remove old completed and failed deployments
381 614
 
382 615
 ====
383 616
 
384 617
 [options="nowrap"]
385 618
 ----
386
-<no value>
619
+  # Dry run deleting all but the last complete deployment for every deployment config
620
+  oadm prune deployments --keep-complete=1
621
+
622
+  # To actually perform the prune operation, the confirm flag must be appended
623
+  oadm prune deployments --keep-complete=1 --confirm
387 624
 ----
388 625
 ====
389 626
 
390 627
 
391
-== <no value>
392
-<no value>
628
+== oadm prune groups
629
+Prune OpenShift groups referencing missing records on an external provider.
393 630
 
394 631
 ====
395 632
 
396 633
 [options="nowrap"]
397 634
 ----
398
-<no value>
635
+  # Prune all orphaned groups
636
+  oadm prune groups --sync-config=/path/to/ldap-sync-config.yaml --confirm
637
+
638
+  # Prune all orphaned groups except the ones from the blacklist file
639
+  oadm prune groups --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
640
+
641
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist file
642
+  oadm prune groups --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
643
+
644
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist
645
+  oadm prune groups groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
646
+
399 647
 ----
400 648
 ====
401 649
 
402 650
 
403
-== <no value>
404
-<no value>
651
+== oadm prune images
652
+Remove unreferenced images
405 653
 
406 654
 ====
407 655
 
408 656
 [options="nowrap"]
409 657
 ----
410
-<no value>
658
+  # See, what the prune command would delete if only images more than an hour old and obsoleted
659
+  # by 3 newer revisions under the same tag were considered.
660
+  oadm prune images --keep-tag-revisions=3 --keep-younger-than=60m
661
+
662
+  # To actually perform the prune operation, the confirm flag must be appended
663
+  oadm prune images --keep-tag-revisions=3 --keep-younger-than=60m --confirm
664
+
665
+  # See, what the prune command would delete if we're interested in removing images
666
+  # exceeding currently set LimitRanges ('openshift.io/Image')
667
+  oadm prune images --prune-over-size-limit
668
+
669
+  # To actually perform the prune operation, the confirm flag must be appended
670
+  oadm prune images --prune-over-size-limit --confirm
411 671
 ----
412 672
 ====
413 673
 
414 674
 
415
-== <no value>
416
-<no value>
675
+== oadm registry
676
+Install the integrated Docker registry
417 677
 
418 678
 ====
419 679
 
420 680
 [options="nowrap"]
421 681
 ----
422
-<no value>
682
+  # Check if default Docker registry ("docker-registry") has been created
683
+  oadm registry --dry-run
684
+
685
+  # See what the registry will look like if created
686
+  oadm registry -o yaml
687
+
688
+  # Create a registry with two replicas if it does not exist
689
+  oadm registry --replicas=2
690
+
691
+  # Use a different registry image
692
+  oadm registry --images=myrepo/docker-registry:mytag
693
+
694
+  # Enforce quota and limits on images
695
+  oadm registry --enforce-quota
423 696
 ----
424 697
 ====
425 698
 
426 699
 
427
-== <no value>
428
-<no value>
700
+== oadm router
701
+Install a router
429 702
 
430 703
 ====
431 704
 
432 705
 [options="nowrap"]
433 706
 ----
434
-<no value>
707
+  # Check the default router ("router")
708
+  oadm router --dry-run
709
+
710
+  # See what the router would look like if created
711
+  oadm router -o yaml
712
+
713
+  # Create a router with two replicas if it does not exist
714
+  oadm router router-west --replicas=2
715
+
716
+  # Use a different router image
717
+  oadm router region-west --images=myrepo/somerouter:mytag
718
+
719
+  # Run the router with a hint to the underlying implementation to _not_ expose statistics.
720
+  oadm router router-west --stats-port=0
721
+  
435 722
 ----
436 723
 ====
437 724
 
438 725
 
439
-== <no value>
440
-<no value>
726
+== oadm taint
727
+Update the taints on one or more nodes
441 728
 
442 729
 ====
443 730
 
444 731
 [options="nowrap"]
445 732
 ----
446
-<no value>
733
+
734
+# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'.
735
+# If a taint with that key and effect already exists, its value is replaced as specified.
736
+oadm taint nodes foo dedicated=special-user:NoSchedule
737
+
738
+# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists.
739
+oadm taint nodes foo dedicated:NoSchedule-
740
+
741
+# Remove from node 'foo' all the taints with key 'dedicated'
742
+oadm taint nodes foo dedicated-
447 743
 ----
448 744
 ====
449 745
 
450 746
 
451
-== <no value>
452
-<no value>
747
+== oadm top images
748
+Show usage statistics for Images
453 749
 
454 750
 ====
455 751
 
456 752
 [options="nowrap"]
457 753
 ----
458
-<no value>
754
+  # Show usage statistics for Images
755
+  oadm top images
459 756
 ----
460 757
 ====
461 758
 
462 759
 
463
-== <no value>
464
-<no value>
760
+== oadm top imagestreams
761
+Show usage statistics for ImageStreams
465 762
 
466 763
 ====
467 764
 
468 765
 [options="nowrap"]
469 766
 ----
470
-<no value>
767
+  # Show usage statistics for ImageStreams
768
+  oadm top imagestreams
471 769
 ----
472 770
 ====
473 771
 
474 772
 
475
-== <no value>
476
-<no value>
773
+== oadm top node
774
+Display Resource (CPU/Memory/Storage) usage of nodes
477 775
 
478 776
 ====
479 777
 
480 778
 [options="nowrap"]
481 779
 ----
482
-<no value>
780
+
781
+# Show metrics for all nodes
782
+kubectl top node
783
+
784
+# Show metrics for a given node
785
+kubectl top node NODE_NAME
483 786
 ----
484 787
 ====
485 788
 
486 789
 
487
-== <no value>
488
-<no value>
790
+== oadm top pod
791
+Display Resource (CPU/Memory/Storage) usage of pods
489 792
 
490 793
 ====
491 794
 
492 795
 [options="nowrap"]
493 796
 ----
494
-<no value>
797
+
798
+# Show metrics for all pods in the default namespace
799
+kubectl top pod
800
+
801
+# Show metrics for all pods in the given namespace
802
+kubectl top pod --namespace=NAMESPACE
803
+
804
+# Show metrics for a given pod and its containers
805
+kubectl top pod POD_NAME --containers
806
+
807
+# Show metrics for the pods defined by label name=myLabel
808
+kubectl top pod -l name=myLabel
495 809
 ----
496 810
 ====
497 811
 
498 812
 
499
-== <no value>
500
-<no value>
813
+== oadm uncordon
814
+Mark node as schedulable
501 815
 
502 816
 ====
503 817
 
504 818
 [options="nowrap"]
505 819
 ----
506
-<no value>
820
+
821
+# Mark node "foo" as schedulable.
822
+$ oadm uncordon foo
823
+
507 824
 ----
508 825
 ====
509 826
 
... ...
@@ -4,1718 +4,2859 @@
4 4
 toc::[]
5 5
 
6 6
 
7
-== <no value>
8
-<no value>
7
+== oc adm build-chain
8
+Output the inputs and dependencies of your builds
9 9
 
10 10
 ====
11 11
 
12 12
 [options="nowrap"]
13 13
 ----
14
-<no value>
14
+  # Build the dependency tree for the 'latest' tag in <image-stream>
15
+  oc adm build-chain <image-stream>
16
+
17
+  # Build the dependency tree for 'v2' tag in dot format and visualize it via the dot utility
18
+  oc adm build-chain <image-stream>:v2 -o dot | dot -T svg -o deps.svg
19
+
20
+  # Build the dependency tree across all namespaces for the specified image stream tag found in 'test' namespace
21
+  oc adm build-chain <image-stream> -n test --all
15 22
 ----
16 23
 ====
17 24
 
18 25
 
19
-== <no value>
20
-<no value>
26
+== oc adm ca decrypt
27
+Decrypt data encrypted with "oc adm ca encrypt"
21 28
 
22 29
 ====
23 30
 
24 31
 [options="nowrap"]
25 32
 ----
26
-<no value>
33
+	# Decrypt an encrypted file to a cleartext file:
34
+	oc adm ca decrypt --key=secret.key --in=secret.encrypted --out=secret.decrypted
35
+	
36
+	# Decrypt from stdin to stdout:
37
+	oc adm ca decrypt --key=secret.key < secret2.encrypted > secret2.decrypted
38
+
27 39
 ----
28 40
 ====
29 41
 
30 42
 
31
-== <no value>
32
-<no value>
43
+== oc adm ca encrypt
44
+Encrypt data with AES-256-CBC encryption
33 45
 
34 46
 ====
35 47
 
36 48
 [options="nowrap"]
37 49
 ----
38
-<no value>
50
+	# Encrypt the content of secret.txt with a generated key:
51
+	oc adm ca encrypt --genkey=secret.key --in=secret.txt --out=secret.encrypted
52
+	
53
+	# Encrypt the content of secret2.txt with an existing key:
54
+	oc adm ca encrypt --key=secret.key < secret2.txt > secret2.encrypted
55
+
39 56
 ----
40 57
 ====
41 58
 
42 59
 
43
-== <no value>
44
-<no value>
60
+== oc adm completion
61
+Output shell completion code for the given shell (bash or zsh)
45 62
 
46 63
 ====
47 64
 
48 65
 [options="nowrap"]
49 66
 ----
50
-<no value>
67
+  # Generate the oc adm completion code for bash
68
+  oc adm completion bash > bash_completion.sh
69
+  source bash_completion.sh
70
+
71
+  # The above example depends on the bash-completion framework.
72
+  It must be sourced before sourcing the openshift cli completion, i.e. on the Mac:
73
+
74
+  brew install bash-completion
75
+  source $(brew --prefix)/etc/bash_completion
76
+  oc adm completion bash > bash_completion.sh
77
+  source bash_completion.sh
78
+
79
+  # In zsh*, the following will load openshift cli zsh completion:
80
+  source <(oc adm completion zsh)
81
+
82
+  * zsh completions are only supported in versions of zsh >= 5.2
51 83
 ----
52 84
 ====
53 85
 
54 86
 
55
-== <no value>
56
-<no value>
87
+== oc adm config
88
+Change configuration files for the client
57 89
 
58 90
 ====
59 91
 
60 92
 [options="nowrap"]
61 93
 ----
62
-<no value>
94
+  # Change the config context to use
95
+  oc adm config use-context my-context
96
+  
97
+  # Set the value of a config preference
98
+  oc adm config set preferences.some true
63 99
 ----
64 100
 ====
65 101
 
66 102
 
67
-== <no value>
68
-<no value>
103
+== oc adm config current-context
104
+Displays the current-context
69 105
 
70 106
 ====
71 107
 
72 108
 [options="nowrap"]
73 109
 ----
74
-<no value>
110
+  
111
+  # Display the current-context
112
+  oc adm config current-context
75 113
 ----
76 114
 ====
77 115
 
78 116
 
79
-== <no value>
80
-<no value>
117
+== oc adm config get-contexts
118
+Describe one or many contexts
81 119
 
82 120
 ====
83 121
 
84 122
 [options="nowrap"]
85 123
 ----
86
-<no value>
124
+  # List all the contexts in your kubeconfig file
125
+  oc adm config get-contexts
126
+  
127
+  # Describe one context in your kubeconfig file.
128
+  oc adm config get-contexts my-context
87 129
 ----
88 130
 ====
89 131
 
90 132
 
91
-== <no value>
92
-<no value>
133
+== oc adm config set-cluster
134
+Sets a cluster entry in kubeconfig
93 135
 
94 136
 ====
95 137
 
96 138
 [options="nowrap"]
97 139
 ----
98
-<no value>
140
+  
141
+  # Set only the server field on the e2e cluster entry without touching other values.
142
+  oc adm config set-cluster e2e --server=https://1.2.3.4
143
+  
144
+  # Embed certificate authority data for the e2e cluster entry
145
+  oc adm config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
146
+  
147
+  # Disable cert checking for the dev cluster entry
148
+  oc adm config set-cluster e2e --insecure-skip-tls-verify=true
99 149
 ----
100 150
 ====
101 151
 
102 152
 
103
-== <no value>
104
-<no value>
153
+== oc adm config set-context
154
+Sets a context entry in kubeconfig
105 155
 
106 156
 ====
107 157
 
108 158
 [options="nowrap"]
109 159
 ----
110
-<no value>
160
+  
161
+  # Set the user field on the gce context entry without touching other values
162
+  oc adm config set-context gce --user=cluster-admin
111 163
 ----
112 164
 ====
113 165
 
114 166
 
115
-== <no value>
116
-<no value>
167
+== oc adm config set-credentials
168
+Sets a user entry in kubeconfig
117 169
 
118 170
 ====
119 171
 
120 172
 [options="nowrap"]
121 173
 ----
122
-<no value>
174
+  
175
+  # Set only the "client-key" field on the "cluster-admin"
176
+  # entry, without touching other values:
177
+  oc adm config set-credentials cluster-admin --client-key=~/.kube/admin.key
178
+  
179
+  # Set basic auth for the "cluster-admin" entry
180
+  oc adm config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
181
+  
182
+  # Embed client certificate data in the "cluster-admin" entry
183
+  oc adm config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
184
+  
185
+  # Enable the Google Compute Platform auth provider for the "cluster-admin" entry
186
+  oc adm config set-credentials cluster-admin --auth-provider=gcp
187
+  
188
+  # Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional args
189
+  oc adm config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
190
+  
191
+  # Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
192
+  oc adm config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
123 193
 ----
124 194
 ====
125 195
 
126 196
 
127
-== <no value>
128
-<no value>
197
+== oc adm config view
198
+Display merged kubeconfig settings or a specified kubeconfig file
129 199
 
130 200
 ====
131 201
 
132 202
 [options="nowrap"]
133 203
 ----
134
-<no value>
204
+  
205
+  # Show Merged kubeconfig settings.
206
+  oc adm config view
207
+  
208
+  # Get the password for the e2e user
209
+  oc adm config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
135 210
 ----
136 211
 ====
137 212
 
138 213
 
139
-== <no value>
140
-<no value>
214
+== oc adm cordon
215
+Mark node as unschedulable
141 216
 
142 217
 ====
143 218
 
144 219
 [options="nowrap"]
145 220
 ----
146
-<no value>
221
+
222
+# Mark node "foo" as unschedulable.
223
+oc adm cordon foo
224
+
147 225
 ----
148 226
 ====
149 227
 
150 228
 
151
-== <no value>
152
-<no value>
229
+== oc adm drain
230
+Drain node in preparation for maintenance
153 231
 
154 232
 ====
155 233
 
156 234
 [options="nowrap"]
157 235
 ----
158
-<no value>
236
+
237
+# Drain node "foo", even if there are pods not managed by a ReplicationController, ReplicaSet, Job, or DaemonSet on it.
238
+$ oc adm drain foo --force
239
+
240
+# As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, or DaemonSet, and use a grace period of 15 minutes.
241
+$ oc adm drain foo --grace-period=900
242
+
159 243
 ----
160 244
 ====
161 245
 
162 246
 
163
-== <no value>
164
-<no value>
247
+== oc adm groups add-users
248
+Add users to a group
165 249
 
166 250
 ====
167 251
 
168 252
 [options="nowrap"]
169 253
 ----
170
-<no value>
254
+  # Add user1 and user2 to my-group
255
+  oc adm groups add-users my-group user1 user2
171 256
 ----
172 257
 ====
173 258
 
174 259
 
175
-== <no value>
176
-<no value>
260
+== oc adm groups new
261
+Create a new group
177 262
 
178 263
 ====
179 264
 
180 265
 [options="nowrap"]
181 266
 ----
182
-<no value>
267
+  # Add a group with no users
268
+  oc adm groups new my-group
269
+
270
+  # Add a group with two users
271
+  oc adm groups new my-group user1 user2
272
+
273
+  # Add a group with one user and shorter output
274
+  oc adm groups new my-group user1 -o name
183 275
 ----
184 276
 ====
185 277
 
186 278
 
187
-== <no value>
188
-<no value>
279
+== oc adm groups prune
280
+Prune OpenShift groups referencing missing records on an external provider.
189 281
 
190 282
 ====
191 283
 
192 284
 [options="nowrap"]
193 285
 ----
194
-<no value>
286
+  # Prune all orphaned groups
287
+  oc adm groups prune --sync-config=/path/to/ldap-sync-config.yaml --confirm
288
+
289
+  # Prune all orphaned groups except the ones from the blacklist file
290
+  oc adm groups prune --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
291
+
292
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist file
293
+  oc adm groups prune --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
294
+
295
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist
296
+  oc adm groups prune groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
297
+
195 298
 ----
196 299
 ====
197 300
 
198 301
 
199
-== <no value>
200
-<no value>
302
+== oc adm groups remove-users
303
+Remove users from a group
201 304
 
202 305
 ====
203 306
 
204 307
 [options="nowrap"]
205 308
 ----
206
-<no value>
309
+  # Remove user1 and user2 from my-group
310
+  oc adm groups remove-users my-group user1 user2
207 311
 ----
208 312
 ====
209 313
 
210 314
 
211
-== <no value>
212
-<no value>
315
+== oc adm groups sync
316
+Sync OpenShift groups with records from an external provider.
213 317
 
214 318
 ====
215 319
 
216 320
 [options="nowrap"]
217 321
 ----
218
-<no value>
322
+  # Sync all groups from an LDAP server
323
+  oc adm groups sync --sync-config=/path/to/ldap-sync-config.yaml --confirm
324
+
325
+  # Sync all groups except the ones from the blacklist file from an LDAP server
326
+  oc adm groups sync --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
327
+
328
+  # Sync specific groups specified in a whitelist file with an LDAP server
329
+  oc adm groups sync --whitelist=/path/to/whitelist.txt --sync-config=/path/to/sync-config.yaml --confirm
330
+
331
+  # Sync all OpenShift Groups that have been synced previously with an LDAP server
332
+  oc adm groups sync --type=openshift --sync-config=/path/to/ldap-sync-config.yaml --confirm
333
+
334
+  # Sync specific OpenShift Groups if they have been synced previously with an LDAP server
335
+  oc adm groups sync groups/group1 groups/group2 groups/group3 --sync-config=/path/to/sync-config.yaml --confirm
336
+
219 337
 ----
220 338
 ====
221 339
 
222 340
 
223
-== <no value>
224
-<no value>
341
+== oc adm ipfailover
342
+Install an IP failover group to a set of nodes
225 343
 
226 344
 ====
227 345
 
228 346
 [options="nowrap"]
229 347
 ----
230
-<no value>
348
+  # Check the default IP failover configuration ("ipfailover"):
349
+  oc adm ipfailover
350
+
351
+  # See what the IP failover configuration would look like if it is created:
352
+  oc adm ipfailover -o json
353
+
354
+  # Create an IP failover configuration if it does not already exist:
355
+  oc adm ipfailover ipf --virtual-ips="10.1.1.1-4" --create
356
+
357
+  # Create an IP failover configuration on a selection of nodes labeled
358
+  # "router=us-west-ha" (on 4 nodes with 7 virtual IPs monitoring a service
359
+  # listening on port 80, such as the router process).
360
+  oc adm ipfailover ipfailover --selector="router=us-west-ha" --virtual-ips="1.2.3.4,10.1.1.100-104,5.6.7.8" --watch-port=80 --replicas=4 --create
361
+
362
+  # Use a different IP failover config image and see the configuration:
363
+  oc adm ipfailover ipf-alt --selector="hagroup=us-west-ha" --virtual-ips="1.2.3.4" -o yaml --images=myrepo/myipfailover:mytag
231 364
 ----
232 365
 ====
233 366
 
234 367
 
235
-== <no value>
236
-<no value>
368
+== oc adm manage-node
369
+Manage nodes - list pods, evacuate, or mark ready
237 370
 
238 371
 ====
239 372
 
240 373
 [options="nowrap"]
241 374
 ----
242
-<no value>
375
+	# Block accepting any pods on given nodes
376
+	oc adm manage-node <mynode> --schedulable=false
377
+
378
+	# Mark selected nodes as schedulable
379
+	oc adm manage-node --selector="<env=dev>" --schedulable=true
380
+
381
+	# Migrate selected pods
382
+	oc adm manage-node <mynode> --evacuate --pod-selector="<service=myapp>"
383
+
384
+	# Migrate selected pods, use a grace period of 60 seconds
385
+	oc adm manage-node <mynode> --evacuate --grace-period=60 --pod-selector="<service=myapp>"
386
+
387
+	# Migrate selected pods not backed by replication controller
388
+	oc adm manage-node <mynode> --evacuate --force --pod-selector="<service=myapp>"
389
+
390
+	# Show pods that will be migrated
391
+	oc adm manage-node <mynode> --evacuate --dry-run --pod-selector="<service=myapp>"
392
+
393
+	# List all pods on given nodes
394
+	oc adm manage-node <mynode1> <mynode2> --list-pods
243 395
 ----
244 396
 ====
245 397
 
246 398
 
247
-== <no value>
248
-<no value>
399
+== oc adm migrate image-references
400
+Update embedded Docker image references
249 401
 
250 402
 ====
251 403
 
252 404
 [options="nowrap"]
253 405
 ----
254
-<no value>
406
+  # Perform a dry-run of migrating all "docker.io" references to "myregistry.com"
407
+  oc adm migrate image-references docker.io/*=myregistry.com/*
408
+
409
+  # To actually perform the migration, the confirm flag must be appended
410
+  oc adm migrate image-references docker.io/*=myregistry.com/* --confirm
411
+
412
+  # To see more details of what will be migrated, use the loglevel and output flags
413
+  oc adm migrate image-references docker.io/*=myregistry.com/* --loglevel=2 -o yaml
414
+
415
+  # Migrate from a service IP to an internal service DNS name
416
+  oc adm migrate image-references 172.30.1.54/*=registry.openshift.svc.cluster.local/*
417
+
418
+  # Migrate from a service IP to an internal service DNS name for all deployment configs and builds
419
+  oc adm migrate image-references 172.30.1.54/*=registry.openshift.svc.cluster.local/* --include=buildconfigs,deploymentconfigs
255 420
 ----
256 421
 ====
257 422
 
258 423
 
259
-== <no value>
260
-<no value>
424
+== oc adm migrate storage
425
+Update the stored version of API objects
261 426
 
262 427
 ====
263 428
 
264 429
 [options="nowrap"]
265 430
 ----
266
-<no value>
431
+  # Perform a dry-run of updating all objects
432
+  oc adm migrate storage
433
+
434
+  # To actually perform the update, the confirm flag must be appended
435
+  oc adm migrate storage --confirm
436
+
437
+  # Only migrate pods
438
+  oc adm migrate storage --include=pods --confirm
439
+
440
+  # Only pods that are in namespaces starting with "bar"
441
+  oc adm migrate storage --include=pods --confirm --from-key=bar/ --to-key=bar/\xFF
442
+
267 443
 ----
268 444
 ====
269 445
 
270 446
 
271
-== <no value>
272
-<no value>
447
+== oc adm pod-network isolate-projects
448
+Isolate project network
273 449
 
274 450
 ====
275 451
 
276 452
 [options="nowrap"]
277 453
 ----
278
-<no value>
454
+	# Provide isolation for project p1
455
+	oc adm pod-network isolate-projects <p1>
456
+
457
+	# Allow all projects with label name=top-secret to have their own isolated project network
458
+	oc adm pod-network isolate-projects --selector='name=top-secret'
279 459
 ----
280 460
 ====
281 461
 
282 462
 
283
-== <no value>
284
-<no value>
463
+== oc adm pod-network join-projects
464
+Join project network
285 465
 
286 466
 ====
287 467
 
288 468
 [options="nowrap"]
289 469
 ----
290
-<no value>
470
+	# Allow project p2 to use project p1 network
471
+	oc adm pod-network join-projects --to=<p1> <p2>
472
+
473
+	# Allow all projects with label name=top-secret to use project p1 network
474
+	oc adm pod-network join-projects --to=<p1> --selector='name=top-secret'
291 475
 ----
292 476
 ====
293 477
 
294 478
 
295
-== <no value>
296
-<no value>
479
+== oc adm pod-network make-projects-global
480
+Make project network global
297 481
 
298 482
 ====
299 483
 
300 484
 [options="nowrap"]
301 485
 ----
302
-<no value>
486
+	# Allow project p1 to access all pods in the cluster and vice versa
487
+	oc adm pod-network make-projects-global <p1>
488
+
489
+	# Allow all projects with label name=share to access all pods in the cluster and vice versa
490
+	oc adm pod-network make-projects-global --selector='name=share'
303 491
 ----
304 492
 ====
305 493
 
306 494
 
307
-== <no value>
308
-<no value>
495
+== oc adm policy add-role-to-user
496
+Add a role to users or serviceaccounts for the current project
309 497
 
310 498
 ====
311 499
 
312 500
 [options="nowrap"]
313 501
 ----
314
-<no value>
502
+  # Add the 'view' role to user1 for the current project
503
+  oc adm policy add-role-to-user view user1
504
+
505
+  # Add the 'edit' role to serviceaccount1 for the current project
506
+  oc adm policy add-role-to-user edit -z serviceaccount1
315 507
 ----
316 508
 ====
317 509
 
318 510
 
319
-== <no value>
320
-<no value>
511
+== oc adm policy add-scc-to-user
512
+Add users or serviceaccount to a security context constraint
321 513
 
322 514
 ====
323 515
 
324 516
 [options="nowrap"]
325 517
 ----
326
-<no value>
518
+  # Add the 'restricted' security context contraint to user1 and user2
519
+  oc adm policy add-scc-to-user restricted user1 user2
520
+
521
+  # Add the 'privileged' security context contraint to the service account serviceaccount1 in the current namespace
522
+  oc adm policy add-scc-to-user privileged -z serviceaccount1
327 523
 ----
328 524
 ====
329 525
 
330 526
 
331
-== <no value>
332
-<no value>
527
+== oc adm policy reconcile-cluster-role-bindings
528
+Update cluster role bindings to match the recommended bootstrap policy
333 529
 
334 530
 ====
335 531
 
336 532
 [options="nowrap"]
337 533
 ----
338
-<no value>
534
+  # Display the names of cluster role bindings that would be modified
535
+  oc adm policy reconcile-cluster-role-bindings -o name
536
+
537
+  # Display the cluster role bindings that would be modified, removing any extra subjects
538
+  oc adm policy reconcile-cluster-role-bindings --additive-only=false
539
+
540
+  # Update cluster role bindings that don't match the current defaults
541
+  oc adm policy reconcile-cluster-role-bindings --confirm
542
+
543
+  # Update cluster role bindings that don't match the current defaults, avoid adding roles to the system:authenticated group
544
+  oc adm policy reconcile-cluster-role-bindings --confirm --exclude-groups=system:authenticated
545
+
546
+  # Update cluster role bindings that don't match the current defaults, removing any extra subjects from the binding
547
+  oc adm policy reconcile-cluster-role-bindings --confirm --additive-only=false
339 548
 ----
340 549
 ====
341 550
 
342 551
 
343
-== <no value>
344
-<no value>
552
+== oc adm policy reconcile-cluster-roles
553
+Update cluster roles to match the recommended bootstrap policy
345 554
 
346 555
 ====
347 556
 
348 557
 [options="nowrap"]
349 558
 ----
350
-<no value>
559
+  # Display the names of cluster roles that would be modified
560
+  oc adm policy reconcile-cluster-roles -o name
561
+
562
+  # Add missing permissions to cluster roles that don't match the current defaults
563
+  oc adm policy reconcile-cluster-roles --confirm
564
+
565
+  # Add missing permissions and remove extra permissions from
566
+  # cluster roles that don't match the current defaults
567
+  oc adm policy reconcile-cluster-roles --additive-only=false --confirm
568
+
569
+  # Display the union of the default and modified cluster roles
570
+  oc adm policy reconcile-cluster-roles --additive-only
351 571
 ----
352 572
 ====
353 573
 
354 574
 
355
-== <no value>
356
-<no value>
575
+== oc adm policy reconcile-sccs
576
+Replace cluster SCCs to match the recommended bootstrap policy
357 577
 
358 578
 ====
359 579
 
360 580
 [options="nowrap"]
361 581
 ----
362
-<no value>
582
+  # Display the cluster SCCs that would be modified
583
+  oc adm policy reconcile-sccs
584
+
585
+  # Update cluster SCCs that don't match the current defaults preserving additional grants
586
+  # for users and group and keeping any priorities that are already set
587
+  oc adm policy reconcile-sccs --confirm
588
+
589
+  # Replace existing users, groups, and priorities that do not match defaults
590
+  oc adm policy reconcile-sccs --additive-only=false --confirm
363 591
 ----
364 592
 ====
365 593
 
366 594
 
367
-== <no value>
368
-<no value>
595
+== oc adm prune builds
596
+Remove old completed and failed builds
369 597
 
370 598
 ====
371 599
 
372 600
 [options="nowrap"]
373 601
 ----
374
-<no value>
602
+  # Dry run deleting older completed and failed builds and also including
603
+  # all builds whose associated BuildConfig no longer exists
604
+  oc adm prune builds --orphans
605
+
606
+  # To actually perform the prune operation, the confirm flag must be appended
607
+  oc adm prune builds --orphans --confirm
375 608
 ----
376 609
 ====
377 610
 
378 611
 
379
-== <no value>
380
-<no value>
612
+== oc adm prune deployments
613
+Remove old completed and failed deployments
381 614
 
382 615
 ====
383 616
 
384 617
 [options="nowrap"]
385 618
 ----
386
-<no value>
619
+  # Dry run deleting all but the last complete deployment for every deployment config
620
+  oc adm prune deployments --keep-complete=1
621
+
622
+  # To actually perform the prune operation, the confirm flag must be appended
623
+  oc adm prune deployments --keep-complete=1 --confirm
387 624
 ----
388 625
 ====
389 626
 
390 627
 
391
-== <no value>
392
-<no value>
628
+== oc adm prune groups
629
+Prune OpenShift groups referencing missing records on an external provider.
393 630
 
394 631
 ====
395 632
 
396 633
 [options="nowrap"]
397 634
 ----
398
-<no value>
635
+  # Prune all orphaned groups
636
+  oc adm prune groups --sync-config=/path/to/ldap-sync-config.yaml --confirm
637
+
638
+  # Prune all orphaned groups except the ones from the blacklist file
639
+  oc adm prune groups --blacklist=/path/to/blacklist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
640
+
641
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist file
642
+  oc adm prune groups --whitelist=/path/to/whitelist.txt --sync-config=/path/to/ldap-sync-config.yaml --confirm
643
+
644
+  # Prune all orphaned groups from a list of specific groups specified in a whitelist
645
+  oc adm prune groups groups/group_name groups/other_name --sync-config=/path/to/ldap-sync-config.yaml --confirm
646
+
399 647
 ----
400 648
 ====
401 649
 
402 650
 
403
-== <no value>
404
-<no value>
651
+== oc adm prune images
652
+Remove unreferenced images
405 653
 
406 654
 ====
407 655
 
408 656
 [options="nowrap"]
409 657
 ----
410
-<no value>
658
+  # See, what the prune command would delete if only images more than an hour old and obsoleted
659
+  # by 3 newer revisions under the same tag were considered.
660
+  oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m
661
+
662
+  # To actually perform the prune operation, the confirm flag must be appended
663
+  oc adm prune images --keep-tag-revisions=3 --keep-younger-than=60m --confirm
664
+
665
+  # See, what the prune command would delete if we're interested in removing images
666
+  # exceeding currently set LimitRanges ('openshift.io/Image')
667
+  oc adm prune images --prune-over-size-limit
668
+
669
+  # To actually perform the prune operation, the confirm flag must be appended
670
+  oc adm prune images --prune-over-size-limit --confirm
411 671
 ----
412 672
 ====
413 673
 
414 674
 
415
-== <no value>
416
-<no value>
675
+== oc adm registry
676
+Install the integrated Docker registry
417 677
 
418 678
 ====
419 679
 
420 680
 [options="nowrap"]
421 681
 ----
422
-<no value>
682
+  # Check if default Docker registry ("docker-registry") has been created
683
+  oc adm registry --dry-run
684
+
685
+  # See what the registry will look like if created
686
+  oc adm registry -o yaml
687
+
688
+  # Create a registry with two replicas if it does not exist
689
+  oc adm registry --replicas=2
690
+
691
+  # Use a different registry image
692
+  oc adm registry --images=myrepo/docker-registry:mytag
693
+
694
+  # Enforce quota and limits on images
695
+  oc adm registry --enforce-quota
423 696
 ----
424 697
 ====
425 698
 
426 699
 
427
-== <no value>
428
-<no value>
700
+== oc adm router
701
+Install a router
429 702
 
430 703
 ====
431 704
 
432 705
 [options="nowrap"]
433 706
 ----
434
-<no value>
707
+  # Check the default router ("router")
708
+  oc adm router --dry-run
709
+
710
+  # See what the router would look like if created
711
+  oc adm router -o yaml
712
+
713
+  # Create a router with two replicas if it does not exist
714
+  oc adm router router-west --replicas=2
715
+
716
+  # Use a different router image
717
+  oc adm router region-west --images=myrepo/somerouter:mytag
718
+
719
+  # Run the router with a hint to the underlying implementation to _not_ expose statistics.
720
+  oc adm router router-west --stats-port=0
721
+  
435 722
 ----
436 723
 ====
437 724
 
438 725
 
439
-== <no value>
440
-<no value>
726
+== oc adm taint
727
+Update the taints on one or more nodes
441 728
 
442 729
 ====
443 730
 
444 731
 [options="nowrap"]
445 732
 ----
446
-<no value>
733
+
734
+# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'.
735
+# If a taint with that key and effect already exists, its value is replaced as specified.
736
+oc adm taint nodes foo dedicated=special-user:NoSchedule
737
+
738
+# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists.
739
+oc adm taint nodes foo dedicated:NoSchedule-
740
+
741
+# Remove from node 'foo' all the taints with key 'dedicated'
742
+oc adm taint nodes foo dedicated-
447 743
 ----
448 744
 ====
449 745
 
450 746
 
451
-== <no value>
452
-<no value>
747
+== oc adm top images
748
+Show usage statistics for Images
453 749
 
454 750
 ====
455 751
 
456 752
 [options="nowrap"]
457 753
 ----
458
-<no value>
754
+  # Show usage statistics for Images
755
+  oc adm top images
459 756
 ----
460 757
 ====
461 758
 
462 759
 
463
-== <no value>
464
-<no value>
760
+== oc adm top imagestreams
761
+Show usage statistics for ImageStreams
465 762
 
466 763
 ====
467 764
 
468 765
 [options="nowrap"]
469 766
 ----
470
-<no value>
767
+  # Show usage statistics for ImageStreams
768
+  oc adm top imagestreams
471 769
 ----
472 770
 ====
473 771
 
474 772
 
475
-== <no value>
476
-<no value>
773
+== oc adm top node
774
+Display Resource (CPU/Memory/Storage) usage of nodes
477 775
 
478 776
 ====
479 777
 
480 778
 [options="nowrap"]
481 779
 ----
482
-<no value>
780
+
781
+# Show metrics for all nodes
782
+kubectl top node
783
+
784
+# Show metrics for a given node
785
+kubectl top node NODE_NAME
483 786
 ----
484 787
 ====
485 788
 
486 789
 
487
-== <no value>
488
-<no value>
790
+== oc adm top pod
791
+Display Resource (CPU/Memory/Storage) usage of pods
489 792
 
490 793
 ====
491 794
 
492 795
 [options="nowrap"]
493 796
 ----
494
-<no value>
797
+
798
+# Show metrics for all pods in the default namespace
799
+kubectl top pod
800
+
801
+# Show metrics for all pods in the given namespace
802
+kubectl top pod --namespace=NAMESPACE
803
+
804
+# Show metrics for a given pod and its containers
805
+kubectl top pod POD_NAME --containers
806
+
807
+# Show metrics for the pods defined by label name=myLabel
808
+kubectl top pod -l name=myLabel
495 809
 ----
496 810
 ====
497 811
 
498 812
 
499
-== <no value>
500
-<no value>
813
+== oc adm uncordon
814
+Mark node as schedulable
501 815
 
502 816
 ====
503 817
 
504 818
 [options="nowrap"]
505 819
 ----
506
-<no value>
820
+
821
+# Mark node "foo" as schedulable.
822
+$ oc adm uncordon foo
823
+
507 824
 ----
508 825
 ====
509 826
 
510 827
 
511
-== <no value>
512
-<no value>
828
+== oc annotate
829
+Update the annotations on a resource
513 830
 
514 831
 ====
515 832
 
516 833
 [options="nowrap"]
517 834
 ----
518
-<no value>
835
+  # Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
836
+  # If the same annotation is set multiple times, only the last value will be applied
837
+  oc annotate pods foo description='my frontend'
838
+
839
+  # Update pod 'foo' with the annotation 'description' and the value
840
+  # 'my frontend running nginx', overwriting any existing value.
841
+  oc annotate --overwrite pods foo description='my frontend running nginx'
842
+
843
+  # Update all pods in the namespace
844
+  oc annotate pods --all description='my frontend running nginx'
845
+
846
+  # Update pod 'foo' only if the resource is unchanged from version 1.
847
+  oc annotate pods foo description='my frontend running nginx' --resource-version=1
848
+
849
+  # Update pod 'foo' by removing an annotation named 'description' if it exists.
850
+  # Does not require the --overwrite flag.
851
+  oc annotate pods foo description-
519 852
 ----
520 853
 ====
521 854
 
522 855
 
523
-== <no value>
524
-<no value>
856
+== oc apply
857
+Apply a configuration to a resource by filename or stdin
525 858
 
526 859
 ====
527 860
 
528 861
 [options="nowrap"]
529 862
 ----
530
-<no value>
863
+# Apply the configuration in pod.json to a pod.
864
+oc apply -f ./pod.json
865
+
866
+# Apply the JSON passed into stdin to a pod.
867
+cat pod.json | oc apply -f -
531 868
 ----
532 869
 ====
533 870
 
534 871
 
535
-== <no value>
536
-<no value>
872
+== oc attach
873
+Attach to a running container
537 874
 
538 875
 ====
539 876
 
540 877
 [options="nowrap"]
541 878
 ----
542
-<no value>
879
+  # Get output from running pod 123456-7890, using the first container by default
880
+  oc attach 123456-7890
881
+
882
+  # Get output from ruby-container from pod 123456-7890
883
+  oc attach 123456-7890 -c ruby-container
884
+
885
+  # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780
886
+  # and sends stdout/stderr from 'bash' back to the client
887
+  oc attach 123456-7890 -c ruby-container -i -t
543 888
 ----
544 889
 ====
545 890
 
546 891
 
547
-== <no value>
548
-<no value>
892
+== oc autoscale
893
+Autoscale a deployment config or replication controller
549 894
 
550 895
 ====
551 896
 
552 897
 [options="nowrap"]
553 898
 ----
554
-<no value>
899
+  # Auto scale a deployment config "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies:
900
+  oc autoscale dc/foo --min=2 --max=10
901
+
902
+  # Auto scale a replication controller "foo", with the number of pods between 1 to 5, target CPU utilization at 80%
903
+  oc autoscale rc/foo --max=5 --cpu-percent=80
555 904
 ----
556 905
 ====
557 906
 
558 907
 
559
-== <no value>
560
-<no value>
908
+== oc cancel-build
909
+Cancel running, pending, or new builds
561 910
 
562 911
 ====
563 912
 
564 913
 [options="nowrap"]
565 914
 ----
566
-<no value>
915
+  # Cancel the build with the given name
916
+  oc cancel-build ruby-build-2
917
+
918
+  # Cancel the named build and print the build logs
919
+  oc cancel-build ruby-build-2 --dump-logs
920
+
921
+  # Cancel the named build and create a new one with the same parameters
922
+  oc cancel-build ruby-build-2 --restart
923
+
924
+  # Cancel multiple builds
925
+  oc cancel-build ruby-build-1 ruby-build-2 ruby-build-3
926
+
927
+  # Cancel all builds created from 'ruby-build' build configuration that are in 'new' state
928
+  oc cancel-build bc/ruby-build --state=new
567 929
 ----
568 930
 ====
569 931
 
570 932
 
571
-== <no value>
572
-<no value>
933
+== oc cluster down
934
+Stop OpenShift on Docker
573 935
 
574 936
 ====
575 937
 
576 938
 [options="nowrap"]
577 939
 ----
578
-<no value>
940
+
941
+  # Stop local Docker cluster
942
+  oc cluster down
943
+
944
+  # Stop cluster running on Docker machine 'mymachine'
945
+  oc cluster down --docker-machine=mymachine
946
+
579 947
 ----
580 948
 ====
581 949
 
582 950
 
583
-== <no value>
584
-<no value>
951
+== oc cluster up
952
+Start OpenShift on Docker with reasonable defaults
585 953
 
586 954
 ====
587 955
 
588 956
 [options="nowrap"]
589 957
 ----
590
-<no value>
958
+
959
+  # Start OpenShift on a new docker machine named 'openshift'
960
+  oc cluster up --create-machine
961
+
962
+  # Start OpenShift using a specific public host name
963
+  oc cluster up --public-hostname=my.address.example.com
964
+
965
+  # Start OpenShift and preserve data and config between restarts
966
+  oc cluster up --host-data-dir=/mydata --use-existing-config
967
+
968
+  # Use a different set of images
969
+  oc cluster up --image="registry.example.com/origin" --version="v1.1"
970
+
591 971
 ----
592 972
 ====
593 973
 
594 974
 
595
-== <no value>
596
-<no value>
975
+== oc completion
976
+Output shell completion code for the given shell (bash or zsh)
597 977
 
598 978
 ====
599 979
 
600 980
 [options="nowrap"]
601 981
 ----
602
-<no value>
982
+  # Generate the oc completion code for bash
983
+  oc completion bash > bash_completion.sh
984
+  source bash_completion.sh
985
+
986
+  # The above example depends on the bash-completion framework.
987
+  It must be sourced before sourcing the openshift cli completion, i.e. on the Mac:
988
+
989
+  brew install bash-completion
990
+  source $(brew --prefix)/etc/bash_completion
991
+  oc completion bash > bash_completion.sh
992
+  source bash_completion.sh
993
+
994
+  # In zsh*, the following will load openshift cli zsh completion:
995
+  source <(oc completion zsh)
996
+
997
+  * zsh completions are only supported in versions of zsh >= 5.2
603 998
 ----
604 999
 ====
605 1000
 
606 1001
 
607
-== <no value>
608
-<no value>
1002
+== oc config
1003
+Change configuration files for the client
609 1004
 
610 1005
 ====
611 1006
 
612 1007
 [options="nowrap"]
613 1008
 ----
614
-<no value>
1009
+  # Change the config context to use
1010
+  oc config use-context my-context
1011
+  
1012
+  # Set the value of a config preference
1013
+  oc config set preferences.some true
615 1014
 ----
616 1015
 ====
617 1016
 
618 1017
 
619
-== <no value>
620
-<no value>
1018
+== oc config current-context
1019
+Displays the current-context
621 1020
 
622 1021
 ====
623 1022
 
624 1023
 [options="nowrap"]
625 1024
 ----
626
-<no value>
1025
+  
1026
+  # Display the current-context
1027
+  oc config current-context
627 1028
 ----
628 1029
 ====
629 1030
 
630 1031
 
631
-== <no value>
632
-<no value>
1032
+== oc config get-contexts
1033
+Describe one or many contexts
633 1034
 
634 1035
 ====
635 1036
 
636 1037
 [options="nowrap"]
637 1038
 ----
638
-<no value>
1039
+  # List all the contexts in your kubeconfig file
1040
+  oc config get-contexts
1041
+  
1042
+  # Describe one context in your kubeconfig file.
1043
+  oc config get-contexts my-context
639 1044
 ----
640 1045
 ====
641 1046
 
642 1047
 
643
-== <no value>
644
-<no value>
1048
+== oc config set-cluster
1049
+Sets a cluster entry in kubeconfig
645 1050
 
646 1051
 ====
647 1052
 
648 1053
 [options="nowrap"]
649 1054
 ----
650
-<no value>
1055
+  
1056
+  # Set only the server field on the e2e cluster entry without touching other values.
1057
+  oc config set-cluster e2e --server=https://1.2.3.4
1058
+  
1059
+  # Embed certificate authority data for the e2e cluster entry
1060
+  oc config set-cluster e2e --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
1061
+  
1062
+  # Disable cert checking for the dev cluster entry
1063
+  oc config set-cluster e2e --insecure-skip-tls-verify=true
651 1064
 ----
652 1065
 ====
653 1066
 
654 1067
 
655
-== <no value>
656
-<no value>
1068
+== oc config set-context
1069
+Sets a context entry in kubeconfig
657 1070
 
658 1071
 ====
659 1072
 
660 1073
 [options="nowrap"]
661 1074
 ----
662
-<no value>
1075
+  
1076
+  # Set the user field on the gce context entry without touching other values
1077
+  oc config set-context gce --user=cluster-admin
663 1078
 ----
664 1079
 ====
665 1080
 
666 1081
 
667
-== <no value>
668
-<no value>
1082
+== oc config set-credentials
1083
+Sets a user entry in kubeconfig
669 1084
 
670 1085
 ====
671 1086
 
672 1087
 [options="nowrap"]
673 1088
 ----
674
-<no value>
1089
+  
1090
+  # Set only the "client-key" field on the "cluster-admin"
1091
+  # entry, without touching other values:
1092
+  oc config set-credentials cluster-admin --client-key=~/.kube/admin.key
1093
+  
1094
+  # Set basic auth for the "cluster-admin" entry
1095
+  oc config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
1096
+  
1097
+  # Embed client certificate data in the "cluster-admin" entry
1098
+  oc config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
1099
+  
1100
+  # Enable the Google Compute Platform auth provider for the "cluster-admin" entry
1101
+  oc config set-credentials cluster-admin --auth-provider=gcp
1102
+  
1103
+  # Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional args
1104
+  oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
1105
+  
1106
+  # Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
1107
+  oc config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
675 1108
 ----
676 1109
 ====
677 1110
 
678 1111
 
679
-== <no value>
680
-<no value>
1112
+== oc config view
1113
+Display merged kubeconfig settings or a specified kubeconfig file
681 1114
 
682 1115
 ====
683 1116
 
684 1117
 [options="nowrap"]
685 1118
 ----
686
-<no value>
1119
+  
1120
+  # Show Merged kubeconfig settings.
1121
+  oc config view
1122
+  
1123
+  # Get the password for the e2e user
1124
+  oc config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
687 1125
 ----
688 1126
 ====
689 1127
 
690 1128
 
691
-== <no value>
692
-<no value>
1129
+== oc convert
1130
+Convert config files between different API versions
693 1131
 
694 1132
 ====
695 1133
 
696 1134
 [options="nowrap"]
697 1135
 ----
698
-<no value>
1136
+  # Convert 'pod.yaml' to latest version and print to stdout.
1137
+  oc convert -f pod.yaml
1138
+
1139
+  # Convert the live state of the resource specified by 'pod.yaml' to the latest version
1140
+  # and print to stdout in json format.
1141
+  oc convert -f pod.yaml --local -o json
1142
+
1143
+  # Convert all files under current directory to latest version and create them all.
1144
+  oc convert -f . | oc create -f -
1145
+
699 1146
 ----
700 1147
 ====
701 1148
 
702 1149
 
703
-== <no value>
704
-<no value>
1150
+== oc create
1151
+Create a resource by filename or stdin
705 1152
 
706 1153
 ====
707 1154
 
708 1155
 [options="nowrap"]
709 1156
 ----
710
-<no value>
1157
+  # Create a pod using the data in pod.json.
1158
+  oc create -f pod.json
1159
+  
1160
+  # Create a pod based on the JSON passed into stdin.
1161
+  cat pod.json | oc create -f -
711 1162
 ----
712 1163
 ====
713 1164
 
714 1165
 
715
-== <no value>
716
-<no value>
1166
+== oc create clusterresourcequota
1167
+Create cluster resource quota resource.
717 1168
 
718 1169
 ====
719 1170
 
720 1171
 [options="nowrap"]
721 1172
 ----
722
-<no value>
1173
+  # Create a cluster resource quota limited to 10 pods
1174
+  oc create clusterresourcequota limit-bob --project-annotation-selector=openshift.io/requester=user-bob --hard=pods=10
723 1175
 ----
724 1176
 ====
725 1177
 
726 1178
 
727
-== <no value>
728
-<no value>
1179
+== oc create configmap
1180
+Create a configmap from a local file, directory or literal value
729 1181
 
730 1182
 ====
731 1183
 
732 1184
 [options="nowrap"]
733 1185
 ----
734
-<no value>
1186
+  
1187
+  # Create a new configmap named my-config with keys for each file in folder bar
1188
+  oc create configmap my-config --from-file=path/to/bar
1189
+  
1190
+  # Create a new configmap named my-config with specified keys instead of names on disk
1191
+  oc create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
1192
+  
1193
+  # Create a new configmap named my-config with key1=config1 and key2=config2
1194
+  oc create configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
735 1195
 ----
736 1196
 ====
737 1197
 
738 1198
 
739
-== <no value>
740
-<no value>
1199
+== oc create deployment
1200
+Create a deployment with the specified name.
741 1201
 
742 1202
 ====
743 1203
 
744 1204
 [options="nowrap"]
745 1205
 ----
746
-<no value>
1206
+  
1207
+  # Create a new deployment named my-dep that runs the busybox image.
1208
+  oc create deployment my-dep --image=busybox
747 1209
 ----
748 1210
 ====
749 1211
 
750 1212
 
751
-== <no value>
752
-<no value>
1213
+== oc create deploymentconfig
1214
+Create deployment config with default options that uses a given image.
753 1215
 
754 1216
 ====
755 1217
 
756 1218
 [options="nowrap"]
757 1219
 ----
758
-<no value>
1220
+  # Create an nginx deployment config named my-nginx
1221
+  oc create deploymentconfig my-nginx --image=nginx
759 1222
 ----
760 1223
 ====
761 1224
 
762 1225
 
763
-== <no value>
764
-<no value>
1226
+== oc create identity
1227
+Manually create an identity (only needed if automatic creation is disabled).
765 1228
 
766 1229
 ====
767 1230
 
768 1231
 [options="nowrap"]
769 1232
 ----
770
-<no value>
1233
+  # Create an identity with identity provider "acme_ldap" and the identity provider username "adamjones"
1234
+  oc create identity acme_ldap:adamjones
771 1235
 ----
772 1236
 ====
773 1237
 
774 1238
 
775
-== <no value>
776
-<no value>
1239
+== oc create imagestream
1240
+Create a new empty image stream.
777 1241
 
778 1242
 ====
779 1243
 
780 1244
 [options="nowrap"]
781 1245
 ----
782
-<no value>
1246
+  # Create a new image stream
1247
+  oc create imagestream mysql
783 1248
 ----
784 1249
 ====
785 1250
 
786 1251
 
787
-== <no value>
788
-<no value>
1252
+== oc create namespace
1253
+Create a namespace with the specified name
789 1254
 
790 1255
 ====
791 1256
 
792 1257
 [options="nowrap"]
793 1258
 ----
794
-<no value>
1259
+  
1260
+  # Create a new namespace named my-namespace
1261
+  oc create namespace my-namespace
795 1262
 ----
796 1263
 ====
797 1264
 
798 1265
 
799
-== <no value>
800
-<no value>
1266
+== oc create policybinding
1267
+Create a policy binding that references the policy in the targetted namespace.
801 1268
 
802 1269
 ====
803 1270
 
804 1271
 [options="nowrap"]
805 1272
 ----
806
-<no value>
1273
+  # Create a policy binding in namespace "foo" that references the policy in namespace "bar"
1274
+  oc create policybinding bar -n foo
807 1275
 ----
808 1276
 ====
809 1277
 
810 1278
 
811
-== <no value>
812
-<no value>
1279
+== oc create quota
1280
+Create a quota with the specified name.
813 1281
 
814 1282
 ====
815 1283
 
816 1284
 [options="nowrap"]
817 1285
 ----
818
-<no value>
1286
+  // Create a new resourcequota named my-quota
1287
+  $ oc create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10
1288
+  
1289
+  // Create a new resourcequota named best-effort
1290
+  $ oc create quota best-effort --hard=pods=100 --scopes=BestEffort
819 1291
 ----
820 1292
 ====
821 1293
 
822 1294
 
823
-== <no value>
824
-<no value>
1295
+== oc create route edge
1296
+Create a route that uses edge TLS termination
825 1297
 
826 1298
 ====
827 1299
 
828 1300
 [options="nowrap"]
829 1301
 ----
830
-<no value>
1302
+  # Create an edge route named "my-route" that exposes frontend service.
1303
+  oc create route edge my-route --service=frontend
1304
+  
1305
+  # Create an edge route that exposes the frontend service and specify a path.
1306
+  # If the route name is omitted, the service name will be re-used.
1307
+  oc create route edge --service=frontend --path /assets
831 1308
 ----
832 1309
 ====
833 1310
 
834 1311
 
835
-== <no value>
836
-<no value>
1312
+== oc create route passthrough
1313
+Create a route that uses passthrough TLS termination
837 1314
 
838 1315
 ====
839 1316
 
840 1317
 [options="nowrap"]
841 1318
 ----
842
-<no value>
1319
+  # Create a passthrough route named "my-route" that exposes the frontend service.
1320
+  oc create route passthrough my-route --service=frontend
1321
+  
1322
+  # Create a passthrough route that exposes the frontend service and specify
1323
+  # a hostname. If the route name is omitted, the service name will be re-used.
1324
+  oc create route passthrough --service=frontend --hostname=www.example.com
843 1325
 ----
844 1326
 ====
845 1327
 
846 1328
 
847
-== <no value>
848
-<no value>
1329
+== oc create route reencrypt
1330
+Create a route that uses reencrypt TLS termination
849 1331
 
850 1332
 ====
851 1333
 
852 1334
 [options="nowrap"]
853 1335
 ----
854
-<no value>
1336
+  # Create a route named "my-route" that exposes the frontend service.
1337
+  oc create route reencrypt my-route --service=frontend --dest-ca-cert cert.cert
1338
+  
1339
+  # Create a reencrypt route that exposes the frontend service and re-use
1340
+  # the service name as the route name.
1341
+  oc create route reencrypt --service=frontend --dest-ca-cert cert.cert
855 1342
 ----
856 1343
 ====
857 1344
 
858 1345
 
859
-== <no value>
860
-<no value>
1346
+== oc create secret docker-registry
1347
+Create a secret for use with a Docker registry
861 1348
 
862 1349
 ====
863 1350
 
864 1351
 [options="nowrap"]
865 1352
 ----
866
-<no value>
1353
+  
1354
+  # If you don't already have a .dockercfg file, you can create a dockercfg secret directly by using:
1355
+  oc create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
867 1356
 ----
868 1357
 ====
869 1358
 
870 1359
 
871
-== <no value>
872
-<no value>
1360
+== oc create secret generic
1361
+Create a secret from a local file, directory or literal value
873 1362
 
874 1363
 ====
875 1364
 
876 1365
 [options="nowrap"]
877 1366
 ----
878
-<no value>
1367
+  
1368
+  # Create a new secret named my-secret with keys for each file in folder bar
1369
+  oc create secret generic my-secret --from-file=path/to/bar
1370
+  
1371
+  # Create a new secret named my-secret with specified keys instead of names on disk
1372
+  oc create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
1373
+  
1374
+  # Create a new secret named my-secret with key1=supersecret and key2=topsecret
1375
+  oc create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
879 1376
 ----
880 1377
 ====
881 1378
 
882 1379
 
883
-== <no value>
884
-<no value>
1380
+== oc create secret tls
1381
+Create a TLS secret
885 1382
 
886 1383
 ====
887 1384
 
888 1385
 [options="nowrap"]
889 1386
 ----
890
-<no value>
1387
+  
1388
+  # Create a new TLS secret named tls-secret with the given key pair:
1389
+  oc create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key
891 1390
 ----
892 1391
 ====
893 1392
 
894 1393
 
895
-== <no value>
896
-<no value>
1394
+== oc create service clusterip
1395
+Create a clusterIP service.
897 1396
 
898 1397
 ====
899 1398
 
900 1399
 [options="nowrap"]
901 1400
 ----
902
-<no value>
1401
+  
1402
+  # Create a new clusterIP service named my-cs
1403
+  oc create service clusterip my-cs --tcp=5678:8080
1404
+  
1405
+  # Create a new clusterIP service named my-cs (in headless mode)
1406
+  oc create service clusterip my-cs --clusterip="None"
903 1407
 ----
904 1408
 ====
905 1409
 
906 1410
 
907
-== <no value>
908
-<no value>
1411
+== oc create service loadbalancer
1412
+Create a LoadBalancer service.
909 1413
 
910 1414
 ====
911 1415
 
912 1416
 [options="nowrap"]
913 1417
 ----
914
-<no value>
1418
+  
1419
+  # Create a new nodeport service named my-lbs
1420
+  oc create service loadbalancer my-lbs --tcp=5678:8080
915 1421
 ----
916 1422
 ====
917 1423
 
918 1424
 
919
-== <no value>
920
-<no value>
1425
+== oc create service nodeport
1426
+Create a NodePort service.
921 1427
 
922 1428
 ====
923 1429
 
924 1430
 [options="nowrap"]
925 1431
 ----
926
-<no value>
1432
+  
1433
+  # Create a new nodeport service named my-ns
1434
+  oc create service nodeport my-ns --tcp=5678:8080
927 1435
 ----
928 1436
 ====
929 1437
 
930 1438
 
931
-== <no value>
932
-<no value>
1439
+== oc create serviceaccount
1440
+Create a service account with the specified name
933 1441
 
934 1442
 ====
935 1443
 
936 1444
 [options="nowrap"]
937 1445
 ----
938
-<no value>
1446
+  
1447
+  # Create a new service account named my-service-account
1448
+  $ oc create serviceaccount my-service-account
939 1449
 ----
940 1450
 ====
941 1451
 
942 1452
 
943
-== <no value>
944
-<no value>
1453
+== oc create user
1454
+Manually create a user (only needed if automatic creation is disabled).
945 1455
 
946 1456
 ====
947 1457
 
948 1458
 [options="nowrap"]
949 1459
 ----
950
-<no value>
1460
+  # Create a user with the username "ajones" and the display name "Adam Jones"
1461
+  oc create user ajones --full-name="Adam Jones"
951 1462
 ----
952 1463
 ====
953 1464
 
954 1465
 
955
-== <no value>
956
-<no value>
1466
+== oc create useridentitymapping
1467
+Manually map an identity to a user.
957 1468
 
958 1469
 ====
959 1470
 
960 1471
 [options="nowrap"]
961 1472
 ----
962
-<no value>
1473
+  # Map the identity "acme_ldap:adamjones" to the user "ajones"
1474
+  oc create useridentitymapping acme_ldap:adamjones ajones
963 1475
 ----
964 1476
 ====
965 1477
 
966 1478
 
967
-== <no value>
968
-<no value>
1479
+== oc debug
1480
+Launch a new instance of a pod for debugging
969 1481
 
970 1482
 ====
971 1483
 
972 1484
 [options="nowrap"]
973 1485
 ----
974
-<no value>
1486
+
1487
+  # Debug a currently running deployment
1488
+  oc debug dc/test
1489
+
1490
+  # Test running a deployment as a non-root user
1491
+  oc debug dc/test --as-user=1000000
1492
+
1493
+  # Debug a specific failing container by running the env command in the 'second' container
1494
+  oc debug dc/test -c second -- /bin/env
1495
+
1496
+  # See the pod that would be created to debug
1497
+  oc debug dc/test -o yaml
975 1498
 ----
976 1499
 ====
977 1500
 
978 1501
 
979
-== <no value>
980
-<no value>
1502
+== oc delete
1503
+Delete one or more resources
981 1504
 
982 1505
 ====
983 1506
 
984 1507
 [options="nowrap"]
985 1508
 ----
986
-<no value>
1509
+  # Delete a pod using the type and ID specified in pod.json.
1510
+  oc delete -f pod.json
1511
+
1512
+  # Delete a pod based on the type and ID in the JSON passed into stdin.
1513
+  cat pod.json | oc delete -f -
1514
+
1515
+  # Delete pods and services with label name=myLabel.
1516
+  oc delete pods,services -l name=myLabel
1517
+
1518
+  # Delete a pod with name node-1-vsjnm.
1519
+  oc delete pod node-1-vsjnm
1520
+
1521
+  # Delete all resources associated with a running app, includes
1522
+  # buildconfig,deploymentconfig,service,imagestream,route and pod,
1523
+  # where 'appName' is listed in 'Labels' of 'oc describe [resource] [resource name]' output.
1524
+  oc delete all -l app=appName
1525
+
1526
+  # Delete all pods
1527
+  oc delete pods --all
987 1528
 ----
988 1529
 ====
989 1530
 
990 1531
 
991
-== <no value>
992
-<no value>
1532
+== oc deploy
1533
+View, start, cancel, or retry a deployment
993 1534
 
994 1535
 ====
995 1536
 
996 1537
 [options="nowrap"]
997 1538
 ----
998
-<no value>
1539
+  # Display the latest deployment for the 'database' deployment config
1540
+  oc deploy database
1541
+
1542
+  # Start a new deployment based on the 'database'
1543
+  oc deploy database --latest
1544
+
1545
+  # Start a new deployment and follow its log
1546
+  oc deploy database --latest --follow
1547
+
1548
+  # Retry the latest failed deployment based on 'frontend'
1549
+  # The deployer pod and any hook pods are deleted for the latest failed deployment
1550
+  oc deploy frontend --retry
1551
+
1552
+  # Cancel the in-progress deployment based on 'frontend'
1553
+  oc deploy frontend --cancel
999 1554
 ----
1000 1555
 ====
1001 1556
 
1002 1557
 
1003
-== <no value>
1004
-<no value>
1558
+== oc describe
1559
+Show details of a specific resource or group of resources
1005 1560
 
1006 1561
 ====
1007 1562
 
1008 1563
 [options="nowrap"]
1009 1564
 ----
1010
-<no value>
1565
+  # Provide details about the ruby-22-centos7 image repository
1566
+  oc describe imageRepository ruby-22-centos7
1567
+
1568
+  # Provide details about the ruby-sample-build build configuration
1569
+  oc describe bc ruby-sample-build
1011 1570
 ----
1012 1571
 ====
1013 1572
 
1014 1573
 
1015
-== <no value>
1016
-<no value>
1574
+== oc edit
1575
+Edit a resource on the server
1017 1576
 
1018 1577
 ====
1019 1578
 
1020 1579
 [options="nowrap"]
1021 1580
 ----
1022
-<no value>
1581
+  # Edit the service named 'docker-registry':
1582
+  oc edit svc/docker-registry
1583
+
1584
+  # Edit the DeploymentConfig named 'my-deployment':
1585
+  oc edit dc/my-deployment
1586
+
1587
+  # Use an alternative editor
1588
+  OC_EDITOR="nano" oc edit dc/my-deployment
1589
+
1590
+  # Edit the service 'docker-registry' in JSON using the v1 API format:
1591
+  oc edit svc/docker-registry --output-version=v1 -o json
1023 1592
 ----
1024 1593
 ====
1025 1594
 
1026 1595
 
1027
-== <no value>
1028
-<no value>
1596
+== oc env
1597
+DEPRECATED: set env
1029 1598
 
1030 1599
 ====
1031 1600
 
1032 1601
 [options="nowrap"]
1033 1602
 ----
1034
-<no value>
1603
+  # Update deployment 'registry' with a new environment variable
1604
+  oc env dc/registry STORAGE_DIR=/local
1605
+
1606
+  # List the environment variables defined on a build config 'sample-build'
1607
+  oc env bc/sample-build --list
1608
+
1609
+  # List the environment variables defined on all pods
1610
+  oc env pods --all --list
1611
+
1612
+  # Output modified build config in YAML, and does not alter the object on the server
1613
+  oc env bc/sample-build STORAGE_DIR=/data -o yaml
1614
+
1615
+  # Update all containers in all replication controllers in the project to have ENV=prod
1616
+  oc env rc --all ENV=prod
1617
+
1618
+  # Import environment from a secret
1619
+  oc env --from=secret/mysecret dc/myapp
1620
+
1621
+  # Import environment from a config map with a prefix
1622
+  oc env --from=configmap/myconfigmap --prefix=MYSQL_ dc/myapp
1623
+
1624
+  # Remove the environment variable ENV from container 'c1' in all deployment configs
1625
+  oc env dc --all --containers="c1" ENV-
1626
+
1627
+  # Remove the environment variable ENV from a deployment config definition on disk and
1628
+  # update the deployment config on the server
1629
+  oc env -f dc.json ENV-
1630
+
1631
+  # Set some of the local shell environment into a deployment config on the server
1632
+  env | grep RAILS_ | oc env -e - dc/registry
1035 1633
 ----
1036 1634
 ====
1037 1635
 
1038 1636
 
1039
-== <no value>
1040
-<no value>
1637
+== oc ex dockerbuild
1638
+Perform a direct Docker build
1041 1639
 
1042 1640
 ====
1043 1641
 
1044 1642
 [options="nowrap"]
1045 1643
 ----
1046
-<no value>
1644
+  # Build the current directory into a single layer and tag
1645
+  oc ex dockerbuild . myimage:latest
1646
+
1647
+  # Mount a client secret into the build at a certain path
1648
+  oc ex dockerbuild . myimage:latest --mount ~/mysecret.pem:/etc/pki/secret/mysecret.pem
1047 1649
 ----
1048 1650
 ====
1049 1651
 
1050 1652
 
1051
-== <no value>
1052
-<no value>
1653
+== oc exec
1654
+Execute a command in a container
1053 1655
 
1054 1656
 ====
1055 1657
 
1056 1658
 [options="nowrap"]
1057 1659
 ----
1058
-<no value>
1660
+  # Get output from running 'date' in ruby-container from pod 'mypod'
1661
+  oc exec mypod -c ruby-container date
1662
+
1663
+  # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 'mypod' and sends stdout/stderr from 'bash' back to the client
1664
+  oc exec mypod -c ruby-container -i -t -- bash -il
1059 1665
 ----
1060 1666
 ====
1061 1667
 
1062 1668
 
1063
-== <no value>
1064
-<no value>
1669
+== oc explain
1670
+Documentation of resources
1065 1671
 
1066 1672
 ====
1067 1673
 
1068 1674
 [options="nowrap"]
1069 1675
 ----
1070
-<no value>
1676
+# Get the documentation of the resource and its fields
1677
+oc explain pods
1678
+
1679
+# Get the documentation of a specific field of a resource
1680
+oc explain pods.spec.containers
1071 1681
 ----
1072 1682
 ====
1073 1683
 
1074 1684
 
1075
-== <no value>
1076
-<no value>
1685
+== oc export
1686
+Export resources so they can be used elsewhere
1077 1687
 
1078 1688
 ====
1079 1689
 
1080 1690
 [options="nowrap"]
1081 1691
 ----
1082
-<no value>
1692
+  # export the services and deployment configurations labeled name=test
1693
+  oc export svc,dc -l name=test
1694
+
1695
+  # export all services to a template
1696
+  oc export service --as-template=test
1697
+
1698
+  # export to JSON
1699
+  oc export service -o json
1083 1700
 ----
1084 1701
 ====
1085 1702
 
1086 1703
 
1087
-== <no value>
1088
-<no value>
1704
+== oc expose
1705
+Expose a replicated application as a service or route
1089 1706
 
1090 1707
 ====
1091 1708
 
1092 1709
 [options="nowrap"]
1093 1710
 ----
1094
-<no value>
1711
+  # Create a route based on service nginx. The new route will re-use nginx's labels
1712
+  oc expose service nginx
1713
+
1714
+  # Create a route and specify your own label and route name
1715
+  oc expose service nginx -l name=myroute --name=fromdowntown
1716
+
1717
+  # Create a route and specify a hostname
1718
+  oc expose service nginx --hostname=www.example.com
1719
+
1720
+  # Expose a deployment configuration as a service and use the specified port
1721
+  oc expose dc ruby-hello-world --port=8080
1722
+
1723
+  # Expose a service as a route in the specified path
1724
+  oc expose service nginx --path=/nginx
1095 1725
 ----
1096 1726
 ====
1097 1727
 
1098 1728
 
1099
-== <no value>
1100
-<no value>
1729
+== oc extract
1730
+Extract secrets or config maps to disk
1101 1731
 
1102 1732
 ====
1103 1733
 
1104 1734
 [options="nowrap"]
1105 1735
 ----
1106
-<no value>
1736
+  # extract the secret "test" to the current directory
1737
+  oc extract secret/test
1738
+
1739
+  # extract the config map "nginx" to the /tmp directory
1740
+  oc extract configmap/nginx --to=/tmp
1741
+
1742
+  # extract only the key "nginx.conf" from config map "nginx" to the /tmp directory
1743
+  oc extract configmap/nginx --to=/tmp --keys=nginx.conf
1107 1744
 ----
1108 1745
 ====
1109 1746
 
1110 1747
 
1111
-== <no value>
1112
-<no value>
1748
+== oc get
1749
+Display one or many resources
1113 1750
 
1114 1751
 ====
1115 1752
 
1116 1753
 [options="nowrap"]
1117 1754
 ----
1118
-<no value>
1755
+  # List all pods in ps output format.
1756
+  oc get pods
1757
+
1758
+  # List a single replication controller with specified ID in ps output format.
1759
+  oc get rc redis
1760
+
1761
+  # List all pods and show more details about them.
1762
+  oc get -o wide pods
1763
+
1764
+  # List a single pod in JSON output format.
1765
+  oc get -o json pod redis-pod
1766
+
1767
+  # Return only the status value of the specified pod.
1768
+  oc get -o template pod redis-pod --template={{.currentState.status}}
1119 1769
 ----
1120 1770
 ====
1121 1771
 
1122 1772
 
1123
-== <no value>
1124
-<no value>
1773
+== oc idle
1774
+Idle scalable resources
1125 1775
 
1126 1776
 ====
1127 1777
 
1128 1778
 [options="nowrap"]
1129 1779
 ----
1130
-<no value>
1780
+  # Idle the scalable controllers associated with the services listed in to-idle.txt
1781
+  $ oc idle --resource-names-file to-idle.txt
1131 1782
 ----
1132 1783
 ====
1133 1784
 
1134 1785
 
1135
-== <no value>
1136
-<no value>
1786
+== oc import app.json
1787
+Import an app.json definition into OpenShift (experimental)
1137 1788
 
1138 1789
 ====
1139 1790
 
1140 1791
 [options="nowrap"]
1141 1792
 ----
1142
-<no value>
1793
+  # Import a directory containing an app.json file
1794
+  $ oc import app.json -f .
1795
+
1796
+  # Turn an app.json file into a template
1797
+  $ oc import app.json -f ./app.json -o yaml --as-template
1798
+
1143 1799
 ----
1144 1800
 ====
1145 1801
 
1146 1802
 
1147
-== <no value>
1148
-<no value>
1803
+== oc import docker-compose
1804
+Import a docker-compose.yml project into OpenShift (experimental)
1149 1805
 
1150 1806
 ====
1151 1807
 
1152 1808
 [options="nowrap"]
1153 1809
 ----
1154
-<no value>
1810
+  # Import a docker-compose.yml file into OpenShift
1811
+  oc import docker-compose -f ./docker-compose.yml
1812
+
1813
+	# Turn a docker-compose.yml file into a template
1814
+  oc import docker-compose -f ./docker-compose.yml -o yaml --as-template
1815
+
1155 1816
 ----
1156 1817
 ====
1157 1818
 
1158 1819
 
1159
-== <no value>
1160
-<no value>
1820
+== oc import-image
1821
+Imports images from a Docker registry
1161 1822
 
1162 1823
 ====
1163 1824
 
1164 1825
 [options="nowrap"]
1165 1826
 ----
1166
-<no value>
1827
+  oc import-image mystream
1167 1828
 ----
1168 1829
 ====
1169 1830
 
1170 1831
 
1171
-== <no value>
1172
-<no value>
1832
+== oc label
1833
+Update the labels on a resource
1173 1834
 
1174 1835
 ====
1175 1836
 
1176 1837
 [options="nowrap"]
1177 1838
 ----
1178
-<no value>
1839
+  # Update pod 'foo' with the label 'unhealthy' and the value 'true'.
1840
+  oc label pods foo unhealthy=true
1841
+
1842
+  # Update pod 'foo' with the label 'status' and the value 'unhealthy', overwriting any existing value.
1843
+  oc label --overwrite pods foo status=unhealthy
1844
+
1845
+  # Update all pods in the namespace
1846
+  oc label pods --all status=unhealthy
1847
+
1848
+  # Update pod 'foo' only if the resource is unchanged from version 1.
1849
+  oc label pods foo status=unhealthy --resource-version=1
1850
+
1851
+  # Update pod 'foo' by removing a label named 'bar' if it exists.
1852
+  # Does not require the --overwrite flag.
1853
+  oc label pods foo bar-
1179 1854
 ----
1180 1855
 ====
1181 1856
 
1182 1857
 
1183
-== <no value>
1184
-<no value>
1858
+== oc login
1859
+Log in to a server
1185 1860
 
1186 1861
 ====
1187 1862
 
1188 1863
 [options="nowrap"]
1189 1864
 ----
1190
-<no value>
1865
+  # Log in interactively
1866
+  oc login
1867
+
1868
+  # Log in to the given server with the given certificate authority file
1869
+  oc login localhost:8443 --certificate-authority=/path/to/cert.crt
1870
+
1871
+  # Log in to the given server with the given credentials (will not prompt interactively)
1872
+  oc login localhost:8443 --username=myuser --password=mypass
1191 1873
 ----
1192 1874
 ====
1193 1875
 
1194 1876
 
1195
-== <no value>
1196
-<no value>
1877
+== oc logout
1878
+End the current server session
1197 1879
 
1198 1880
 ====
1199 1881
 
1200 1882
 [options="nowrap"]
1201 1883
 ----
1202
-<no value>
1884
+
1885
+  # Logout
1886
+  oc logout
1203 1887
 ----
1204 1888
 ====
1205 1889
 
1206 1890
 
1207
-== <no value>
1208
-<no value>
1891
+== oc logs
1892
+Print the logs for a resource.
1209 1893
 
1210 1894
 ====
1211 1895
 
1212 1896
 [options="nowrap"]
1213 1897
 ----
1214
-<no value>
1898
+  # Start streaming the logs of the most recent build of the openldap build config.
1899
+  oc logs -f bc/openldap
1900
+
1901
+  # Start streaming the logs of the latest deployment of the mysql deployment config.
1902
+  oc logs -f dc/mysql
1903
+
1904
+  # Get the logs of the first deployment for the mysql deployment config. Note that logs
1905
+  # from older deployments may not exist either because the deployment was successful
1906
+  # or due to deployment pruning or manual deletion of the deployment.
1907
+  oc logs --version=1 dc/mysql
1908
+
1909
+  # Return a snapshot of ruby-container logs from pod backend.
1910
+  oc logs backend -c ruby-container
1911
+
1912
+  # Start streaming of ruby-container logs from pod backend.
1913
+  oc logs -f pod/backend -c ruby-container
1215 1914
 ----
1216 1915
 ====
1217 1916
 
1218 1917
 
1219
-== <no value>
1220
-<no value>
1918
+== oc new-app
1919
+Create a new application
1221 1920
 
1222 1921
 ====
1223 1922
 
1224 1923
 [options="nowrap"]
1225 1924
 ----
1226
-<no value>
1925
+
1926
+  # List all local templates and image streams that can be used to create an app
1927
+  oc new-app --list
1928
+
1929
+  # Create an application based on the source code in the current git repository (with a public remote)
1930
+  # and a Docker image
1931
+  oc new-app . --docker-image=repo/langimage
1932
+
1933
+  # Create a Ruby application based on the provided [image]~[source code] combination
1934
+  oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git
1935
+
1936
+  # Use the public Docker Hub MySQL image to create an app. Generated artifacts will be labeled with db=mysql
1937
+  oc new-app mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql
1938
+
1939
+  # Use a MySQL image in a private registry to create an app and override application artifacts' names
1940
+  oc new-app --docker-image=myregistry.com/mycompany/mysql --name=private
1941
+
1942
+  # Create an application from a remote repository using its beta4 branch
1943
+  oc new-app https://github.com/openshift/ruby-hello-world#beta4
1944
+
1945
+  # Create an application based on a stored template, explicitly setting a parameter value
1946
+  oc new-app --template=ruby-helloworld-sample --param=MYSQL_USER=admin
1947
+
1948
+  # Create an application from a remote repository and specify a context directory
1949
+  oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build
1950
+
1951
+  # Create an application based on a template file, explicitly setting a parameter value
1952
+  oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin
1953
+
1954
+  # Search all templates, image streams, and Docker images for the ones that match "ruby"
1955
+  oc new-app --search ruby
1956
+
1957
+  # Search for "ruby", but only in stored templates (--template, --image-stream and --docker-image
1958
+  # can be used to filter search results)
1959
+  oc new-app --search --template=ruby
1960
+
1961
+  # Search for "ruby" in stored templates and print the output as an YAML
1962
+  oc new-app --search --template=ruby --output=yaml
1227 1963
 ----
1228 1964
 ====
1229 1965
 
1230 1966
 
1231
-== <no value>
1232
-<no value>
1967
+== oc new-build
1968
+Create a new build configuration
1233 1969
 
1234 1970
 ====
1235 1971
 
1236 1972
 [options="nowrap"]
1237 1973
 ----
1238
-<no value>
1974
+
1975
+  # Create a build config based on the source code in the current git repository (with a public
1976
+  # remote) and a Docker image
1977
+  oc new-build . --docker-image=repo/langimage
1978
+
1979
+  # Create a NodeJS build config based on the provided [image]~[source code] combination
1980
+  oc new-build openshift/nodejs-010-centos7~https://github.com/openshift/nodejs-ex.git
1981
+
1982
+  # Create a build config from a remote repository using its beta2 branch
1983
+  oc new-build https://github.com/openshift/ruby-hello-world#beta2
1984
+
1985
+  # Create a build config using a Dockerfile specified as an argument
1986
+  oc new-build -D $'FROM centos:7\nRUN yum install -y httpd'
1987
+
1988
+  # Create a build config from a remote repository and add custom environment variables
1989
+  oc new-build https://github.com/openshift/ruby-hello-world RACK_ENV=development
1990
+
1991
+  # Create a build config from a remote repository and inject the npmrc into a build
1992
+  oc new-build https://github.com/openshift/ruby-hello-world --build-secret npmrc:.npmrc
1993
+
1994
+  # Create a build config that gets its input from a remote repository and another Docker image
1995
+  oc new-build https://github.com/openshift/ruby-hello-world --source-image=openshift/jenkins-1-centos7 --source-image-path=/var/lib/jenkins:tmp
1239 1996
 ----
1240 1997
 ====
1241 1998
 
1242 1999
 
1243
-== <no value>
1244
-<no value>
2000
+== oc new-project
2001
+Request a new project
1245 2002
 
1246 2003
 ====
1247 2004
 
1248 2005
 [options="nowrap"]
1249 2006
 ----
1250
-<no value>
2007
+  # Create a new project with minimal information
2008
+  oc new-project web-team-dev
2009
+
2010
+  # Create a new project with a display name and description
2011
+  oc new-project web-team-dev --display-name="Web Team Development" --description="Development project for the web team."
1251 2012
 ----
1252 2013
 ====
1253 2014
 
1254 2015
 
1255
-== <no value>
1256
-<no value>
2016
+== oc observe
2017
+Observe changes to resources and react to them (experimental)
1257 2018
 
1258 2019
 ====
1259 2020
 
1260 2021
 [options="nowrap"]
1261 2022
 ----
1262
-<no value>
2023
+	# observe changes to services
2024
+	oc observe services
2025
+
2026
+	# observe changes to services, including the clusterIP and invoke a script for each
2027
+	oc observe services -a '{ .spec.clusterIP }' -- register_dns.sh
2028
+
1263 2029
 ----
1264 2030
 ====
1265 2031
 
1266 2032
 
1267
-== <no value>
1268
-<no value>
2033
+== oc patch
2034
+Update field(s) of a resource using strategic merge patch
1269 2035
 
1270 2036
 ====
1271 2037
 
1272 2038
 [options="nowrap"]
1273 2039
 ----
1274
-<no value>
2040
+  # Partially update a node using strategic merge patch
2041
+  oc patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
1275 2042
 ----
1276 2043
 ====
1277 2044
 
1278 2045
 
1279
-== <no value>
1280
-<no value>
2046
+== oc policy add-role-to-user
2047
+Add a role to users or serviceaccounts for the current project
1281 2048
 
1282 2049
 ====
1283 2050
 
1284 2051
 [options="nowrap"]
1285 2052
 ----
1286
-<no value>
2053
+  # Add the 'view' role to user1 for the current project
2054
+  oc policy add-role-to-user view user1
2055
+
2056
+  # Add the 'edit' role to serviceaccount1 for the current project
2057
+  oc policy add-role-to-user edit -z serviceaccount1
1287 2058
 ----
1288 2059
 ====
1289 2060
 
1290 2061
 
1291
-== <no value>
1292
-<no value>
2062
+== oc port-forward
2063
+Forward one or more local ports to a pod
1293 2064
 
1294 2065
 ====
1295 2066
 
1296 2067
 [options="nowrap"]
1297 2068
 ----
1298
-<no value>
2069
+  # Listens on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
2070
+  oc port-forward mypod 5000 6000
2071
+
2072
+  # Listens on port 8888 locally, forwarding to 5000 in the pod
2073
+  oc port-forward mypod 8888:5000
2074
+
2075
+  # Listens on a random port locally, forwarding to 5000 in the pod
2076
+  oc port-forward mypod :5000
2077
+
2078
+  # Listens on a random port locally, forwarding to 5000 in the pod
2079
+  oc port-forward mypod 0:5000
1299 2080
 ----
1300 2081
 ====
1301 2082
 
1302 2083
 
1303
-== <no value>
1304
-<no value>
2084
+== oc process
2085
+Process a template into list of resources
1305 2086
 
1306 2087
 ====
1307 2088
 
1308 2089
 [options="nowrap"]
1309 2090
 ----
1310
-<no value>
2091
+  # Convert template.json file into resource list and pass to create
2092
+  oc process -f template.json | oc create -f -
2093
+
2094
+  # Process template while passing a user-defined label
2095
+  oc process -f template.json -l name=mytemplate
2096
+
2097
+  # Convert stored template into resource list
2098
+  oc process foo
2099
+
2100
+  # Convert stored template into resource list by setting/overriding parameter values
2101
+  oc process foo PARM1=VALUE1 PARM2=VALUE2
2102
+
2103
+  # Convert template stored in different namespace into a resource list
2104
+  oc process openshift//foo
2105
+
2106
+  # Convert template.json into resource list
2107
+  cat template.json | oc process -f -
1311 2108
 ----
1312 2109
 ====
1313 2110
 
1314 2111
 
1315
-== <no value>
1316
-<no value>
2112
+== oc project
2113
+Switch to another project
1317 2114
 
1318 2115
 ====
1319 2116
 
1320 2117
 [options="nowrap"]
1321 2118
 ----
1322
-<no value>
2119
+  # Switch to 'myapp' project
2120
+  oc project myapp
2121
+
2122
+  # Display the project currently in use
2123
+  oc project
1323 2124
 ----
1324 2125
 ====
1325 2126
 
1326 2127
 
1327
-== <no value>
1328
-<no value>
2128
+== oc proxy
2129
+Run a proxy to the Kubernetes API server
1329 2130
 
1330 2131
 ====
1331 2132
 
1332 2133
 [options="nowrap"]
1333 2134
 ----
1334
-<no value>
2135
+  # Run a proxy to the api server on port 8011, serving static content from ./local/www/
2136
+  oc proxy --port=8011 --www=./local/www/
2137
+
2138
+  # Run a proxy to the api server on an arbitrary local port.
2139
+  # The chosen port for the server will be output to stdout.
2140
+  oc proxy --port=0
2141
+
2142
+  # Run a proxy to the api server, changing the api prefix to my-api
2143
+  # This makes e.g. the pods api available at localhost:8011/my-api/api/v1/pods/
2144
+  oc proxy --api-prefix=/my-api
1335 2145
 ----
1336 2146
 ====
1337 2147
 
1338 2148
 
1339
-== <no value>
1340
-<no value>
2149
+== oc replace
2150
+Replace a resource by filename or stdin
1341 2151
 
1342 2152
 ====
1343 2153
 
1344 2154
 [options="nowrap"]
1345 2155
 ----
1346
-<no value>
2156
+  # Replace a pod using the data in pod.json.
2157
+  oc replace -f pod.json
2158
+
2159
+  # Replace a pod based on the JSON passed into stdin.
2160
+  cat pod.json | oc replace -f -
2161
+
2162
+  # Force replace, delete and then re-create the resource
2163
+  oc replace --force -f pod.json
1347 2164
 ----
1348 2165
 ====
1349 2166
 
1350 2167
 
1351
-== <no value>
1352
-<no value>
2168
+== oc rollback
2169
+Revert part of an application back to a previous deployment
1353 2170
 
1354 2171
 ====
1355 2172
 
1356 2173
 [options="nowrap"]
1357 2174
 ----
1358
-<no value>
2175
+  # Perform a rollback to the last successfully completed deployment for a deploymentconfig
2176
+  oc rollback frontend
2177
+
2178
+  # See what a rollback to version 3 will look like, but don't perform the rollback
2179
+  oc rollback frontend --to-version=3 --dry-run
2180
+
2181
+  # Perform a rollback to a specific deployment
2182
+  oc rollback frontend-2
2183
+
2184
+  # Perform the rollback manually by piping the JSON of the new config back to oc
2185
+  oc rollback frontend -o json | oc replace dc/frontend -f -
1359 2186
 ----
1360 2187
 ====
1361 2188
 
1362 2189
 
1363
-== <no value>
1364
-<no value>
2190
+== oc rollout history
2191
+View rollout history
1365 2192
 
1366 2193
 ====
1367 2194
 
1368 2195
 [options="nowrap"]
1369 2196
 ----
1370
-<no value>
2197
+  # View the rollout history of a deployment
2198
+  oc rollout history dc/nginx
2199
+
2200
+  # View the details of deployment revision 3
2201
+  oc rollout history dc/nginx --revision=3
1371 2202
 ----
1372 2203
 ====
1373 2204
 
1374 2205
 
1375
-== <no value>
1376
-<no value>
2206
+== oc rollout pause
2207
+Mark the provided resource as paused
1377 2208
 
1378 2209
 ====
1379 2210
 
1380 2211
 [options="nowrap"]
1381 2212
 ----
1382
-<no value>
2213
+  # Mark the nginx deployment as paused. Any current state of
2214
+  # the deployment will continue its function, new updates to the deployment will not
2215
+  # have an effect as long as the deployment is paused.
2216
+  oc rollout pause dc/nginx
1383 2217
 ----
1384 2218
 ====
1385 2219
 
1386 2220
 
1387
-== <no value>
1388
-<no value>
2221
+== oc rollout resume
2222
+Resume a paused resource
1389 2223
 
1390 2224
 ====
1391 2225
 
1392 2226
 [options="nowrap"]
1393 2227
 ----
1394
-<no value>
2228
+  # Resume an already paused deployment
2229
+  oc rollout resume dc/nginx
1395 2230
 ----
1396 2231
 ====
1397 2232
 
1398 2233
 
1399
-== <no value>
1400
-<no value>
2234
+== oc rollout undo
2235
+Undo a previous rollout
1401 2236
 
1402 2237
 ====
1403 2238
 
1404 2239
 [options="nowrap"]
1405 2240
 ----
1406
-<no value>
2241
+  # Rollback to the previous deployment
2242
+  oc rollout undo dc/nginx
2243
+
2244
+  # Rollback to deployment revision 3. The replication controller for that version must exist.
2245
+  oc rollout undo dc/nginx --to-revision=3
1407 2246
 ----
1408 2247
 ====
1409 2248
 
1410 2249
 
1411
-== <no value>
1412
-<no value>
2250
+== oc rsh
2251
+Start a shell session in a pod
1413 2252
 
1414 2253
 ====
1415 2254
 
1416 2255
 [options="nowrap"]
1417 2256
 ----
1418
-<no value>
2257
+
2258
+  # Open a shell session on the first container in pod 'foo'
2259
+  oc rsh foo
2260
+
2261
+  # Run the command 'cat /etc/resolv.conf' inside pod 'foo'
2262
+  oc rsh foo cat /etc/resolv.conf
2263
+
2264
+  # See the configuration of your internal registry
2265
+  oc rsh dc/docker-registry cat config.yml
2266
+
2267
+  # Open a shell session on the container named 'index' inside a pod of your job
2268
+  # oc rsh -c index job/sheduled
1419 2269
 ----
1420 2270
 ====
1421 2271
 
1422 2272
 
1423
-== <no value>
1424
-<no value>
2273
+== oc rsync
2274
+Copy files between local filesystem and a pod
1425 2275
 
1426 2276
 ====
1427 2277
 
1428 2278
 [options="nowrap"]
1429 2279
 ----
1430
-<no value>
2280
+
2281
+  # Synchronize a local directory with a pod directory
2282
+  oc rsync ./local/dir/ POD:/remote/dir
2283
+
2284
+  # Synchronize a pod directory with a local directory
2285
+  oc rsync POD:/remote/dir/ ./local/dir
1431 2286
 ----
1432 2287
 ====
1433 2288
 
1434 2289
 
1435
-== <no value>
1436
-<no value>
2290
+== oc run
2291
+Run a particular image on the cluster
1437 2292
 
1438 2293
 ====
1439 2294
 
1440 2295
 [options="nowrap"]
1441 2296
 ----
1442
-<no value>
2297
+  # Starts a single instance of nginx.
2298
+  oc run nginx --image=nginx
2299
+
2300
+  # Starts a replicated instance of nginx.
2301
+  oc run nginx --image=nginx --replicas=5
2302
+
2303
+  # Dry run. Print the corresponding API objects without creating them.
2304
+  oc run nginx --image=nginx --dry-run
2305
+
2306
+  # Start a single instance of nginx, but overload the spec of the replication
2307
+  # controller with a partial set of values parsed from JSON.
2308
+  oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
2309
+
2310
+  # Start a single instance of nginx and keep it in the foreground, don't restart it if it exits.
2311
+  oc run -i --tty nginx --image=nginx --restart=Never
1443 2312
 ----
1444 2313
 ====
1445 2314
 
1446 2315
 
1447
-== <no value>
1448
-<no value>
2316
+== oc scale
2317
+Change the number of pods in a deployment
1449 2318
 
1450 2319
 ====
1451 2320
 
1452 2321
 [options="nowrap"]
1453 2322
 ----
1454
-<no value>
2323
+  # Scale replication controller named 'foo' to 3.
2324
+  oc scale --replicas=3 replicationcontrollers foo
2325
+
2326
+  # If the replication controller named foo's current size is 2, scale foo to 3.
2327
+  oc scale --current-replicas=2 --replicas=3 replicationcontrollers foo
2328
+
2329
+  # Scale the latest deployment of 'bar'. In case of no deployment, bar's template
2330
+  # will be scaled instead.
2331
+  oc scale --replicas=10 dc bar
1455 2332
 ----
1456 2333
 ====
1457 2334
 
1458 2335
 
1459
-== <no value>
1460
-<no value>
2336
+== oc secrets add
2337
+DEPRECATED: secrets link
1461 2338
 
1462 2339
 ====
1463 2340
 
1464 2341
 [options="nowrap"]
1465 2342
 ----
1466
-<no value>
2343
+  # Add an image pull secret to a service account to automatically use it for pulling pod images:
2344
+  oc serviceaccount-name pull-secret --for=pull
2345
+
2346
+  # Add an image pull secret to a service account to automatically use it for both pulling and pushing build images:
2347
+  oc builder builder-image-secret --for=pull,mount
2348
+
2349
+  # If the cluster's serviceAccountConfig is operating with limitSecretReferences: True, secrets must be added to the pod's service account whitelist in order to be available to the pod:
2350
+  oc pod-sa pod-secret
1467 2351
 ----
1468 2352
 ====
1469 2353
 
1470 2354
 
1471
-== <no value>
1472
-<no value>
2355
+== oc secrets link
2356
+Link secrets to a ServiceAccount
1473 2357
 
1474 2358
 ====
1475 2359
 
1476 2360
 [options="nowrap"]
1477 2361
 ----
1478
-<no value>
2362
+  # Add an image pull secret to a service account to automatically use it for pulling pod images:
2363
+  oc secrets link serviceaccount-name pull-secret --for=pull
2364
+
2365
+  # Add an image pull secret to a service account to automatically use it for both pulling and pushing build images:
2366
+  oc secrets link builder builder-image-secret --for=pull,mount
2367
+
2368
+  # If the cluster's serviceAccountConfig is operating with limitSecretReferences: True, secrets must be added to the pod's service account whitelist in order to be available to the pod:
2369
+  oc secrets link pod-sa pod-secret
1479 2370
 ----
1480 2371
 ====
1481 2372
 
1482 2373
 
1483
-== <no value>
1484
-<no value>
2374
+== oc secrets new
2375
+Create a new secret based on a key file or on files within a directory
1485 2376
 
1486 2377
 ====
1487 2378
 
1488 2379
 [options="nowrap"]
1489 2380
 ----
1490
-<no value>
2381
+  # Create a new secret named my-secret with a key named ssh-privatekey
2382
+  oc secrets new my-secret ~/.ssh/ssh-privatekey
2383
+
2384
+  # Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk
2385
+  oc secrets new my-secret ssh-privatekey=~/.ssh/id_rsa ssh-publickey=~/.ssh/id_rsa.pub
2386
+
2387
+  # Create a new secret named my-secret with keys for each file in the folder "bar"
2388
+  oc secrets new my-secret path/to/bar
2389
+
2390
+  # Create a new .dockercfg secret named my-secret
2391
+  oc secrets new my-secret path/to/.dockercfg
2392
+
2393
+  # Create a new .docker/config.json secret named my-secret
2394
+  oc secrets new my-secret .dockerconfigjson=path/to/.docker/config.json
1491 2395
 ----
1492 2396
 ====
1493 2397
 
1494 2398
 
1495
-== <no value>
1496
-<no value>
2399
+== oc secrets new-basicauth
2400
+Create a new secret for basic authentication
1497 2401
 
1498 2402
 ====
1499 2403
 
1500 2404
 [options="nowrap"]
1501 2405
 ----
1502
-<no value>
2406
+  // If your basic authentication method requires only username and password or token, add it by using:
2407
+  oc secrets new-basicauth SECRET --username=USERNAME --password=PASSWORD
2408
+
2409
+  // If your basic authentication method requires also CA certificate, add it by using:
2410
+  oc secrets new-basicauth SECRET --username=USERNAME --password=PASSWORD --ca-cert=FILENAME
2411
+
2412
+  // If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using:
2413
+  oc secrets new SECRET path/to/.gitconfig
1503 2414
 ----
1504 2415
 ====
1505 2416
 
1506 2417
 
1507
-== <no value>
1508
-<no value>
2418
+== oc secrets new-dockercfg
2419
+Create a new dockercfg secret
1509 2420
 
1510 2421
 ====
1511 2422
 
1512 2423
 [options="nowrap"]
1513 2424
 ----
1514
-<no value>
2425
+  # Create a new .dockercfg secret:
2426
+  oc secrets new-dockercfg SECRET --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
2427
+
2428
+  # Create a new .dockercfg secret from an existing file:
2429
+  oc secrets new SECRET path/to/.dockercfg
2430
+
2431
+  # Create a new .docker/config.json secret from an existing file:
2432
+  oc secrets new SECRET .dockerconfigjson=path/to/.docker/config.json
2433
+
2434
+  # To add new secret to 'imagePullSecrets' for the node, or 'secrets' for builds, use:
2435
+  oc edit SERVICE_ACCOUNT
1515 2436
 ----
1516 2437
 ====
1517 2438
 
1518 2439
 
1519
-== <no value>
1520
-<no value>
2440
+== oc secrets new-sshauth
2441
+Create a new secret for SSH authentication
1521 2442
 
1522 2443
 ====
1523 2444
 
1524 2445
 [options="nowrap"]
1525 2446
 ----
1526
-<no value>
2447
+  // If your SSH authentication method requires only private SSH key, add it by using:
2448
+  oc secrets new-sshauth SECRET --ssh-privatekey=FILENAME
2449
+
2450
+  // If your SSH authentication method requires also CA certificate, add it by using:
2451
+  oc secrets new-sshauth SECRET --ssh-privatekey=FILENAME --ca-cert=FILENAME
2452
+
2453
+  // If you do already have a .gitconfig file needed for authentication, you can create a gitconfig secret by using:
2454
+  oc secrets new SECRET path/to/.gitconfig
1527 2455
 ----
1528 2456
 ====
1529 2457
 
1530 2458
 
1531
-== <no value>
1532
-<no value>
2459
+== oc secrets unlink
2460
+Detach secrets from a ServiceAccount
1533 2461
 
1534 2462
 ====
1535 2463
 
1536 2464
 [options="nowrap"]
1537 2465
 ----
1538
-<no value>
2466
+ # Unlink a secret currently associated with a service account:
2467
+oc secrets unlink serviceaccount-name secret-name another-secret-name ...
1539 2468
 ----
1540 2469
 ====
1541 2470
 
1542 2471
 
1543
-== <no value>
1544
-<no value>
2472
+== oc serviceaccounts get-token
2473
+Get a token assigned to a service account.
1545 2474
 
1546 2475
 ====
1547 2476
 
1548 2477
 [options="nowrap"]
1549 2478
 ----
1550
-<no value>
2479
+  # Get the service account token from service account 'default'
2480
+  oc serviceaccounts get-token 'default'
2481
+
1551 2482
 ----
1552 2483
 ====
1553 2484
 
1554 2485
 
1555
-== <no value>
1556
-<no value>
2486
+== oc serviceaccounts new-token
2487
+Generate a new token for a service account.
1557 2488
 
1558 2489
 ====
1559 2490
 
1560 2491
 [options="nowrap"]
1561 2492
 ----
1562
-<no value>
2493
+  # Generate a new token for service account 'default'
2494
+  oc serviceaccounts new-token 'default'
2495
+
2496
+  # Generate a new token for service account 'default' and apply
2497
+  # labels 'foo' and 'bar' to the new token for identification
2498
+  # oc serviceaccounts new-token 'default' --labels foo=foo-value,bar=bar-value
2499
+
1563 2500
 ----
1564 2501
 ====
1565 2502
 
1566 2503
 
1567
-== <no value>
1568
-<no value>
2504
+== oc set build-hook
2505
+Update a build hook on a build config
1569 2506
 
1570 2507
 ====
1571 2508
 
1572 2509
 [options="nowrap"]
1573 2510
 ----
1574
-<no value>
2511
+  # Clear post-commit hook on a build config
2512
+  oc set build-hook bc/mybuild --post-commit --remove
2513
+
2514
+  # Set the post-commit hook to execute a test suite using a new entrypoint
2515
+  oc set build-hook bc/mybuild --post-commit --command -- /bin/bash -c /var/lib/test-image.sh
2516
+
2517
+  # Set the post-commit hook to execute a shell script
2518
+  oc set build-hook bc/mybuild --post-commit --script="/var/lib/test-image.sh param1 param2 && /var/lib/done.sh"
2519
+
2520
+  # Set the post-commit hook as a set of arguments to the default image entrypoint
2521
+  oc set build-hook bc/mybuild --post-commit  -- arg1 arg2
1575 2522
 ----
1576 2523
 ====
1577 2524
 
1578 2525
 
1579
-== <no value>
1580
-<no value>
2526
+== oc set deployment-hook
2527
+Update a deployment hook on a deployment config
1581 2528
 
1582 2529
 ====
1583 2530
 
1584 2531
 [options="nowrap"]
1585 2532
 ----
1586
-<no value>
2533
+  # Clear pre and post hooks on a deployment config
2534
+  oc set deployment-hook dc/myapp --remove --pre --post
2535
+
2536
+  # Set the pre deployment hook to execute a db migration command for an application
2537
+  # using the data volume from the application
2538
+  oc set deployment-hook dc/myapp --pre -v data -- /var/lib/migrate-db.sh
2539
+
2540
+  # Set a mid deployment hook along with additional environment variables
2541
+  oc set deployment-hook dc/myapp --mid -v data -e VAR1=value1 -e VAR2=value2 -- /var/lib/prepare-deploy.sh
1587 2542
 ----
1588 2543
 ====
1589 2544
 
1590 2545
 
1591
-== <no value>
1592
-<no value>
2546
+== oc set env
2547
+Update environment variables on a pod template
1593 2548
 
1594 2549
 ====
1595 2550
 
1596 2551
 [options="nowrap"]
1597 2552
 ----
1598
-<no value>
2553
+  # Update deployment 'registry' with a new environment variable
2554
+  oc set env dc/registry STORAGE_DIR=/local
2555
+
2556
+  # List the environment variables defined on a build config 'sample-build'
2557
+  oc set env bc/sample-build --list
2558
+
2559
+  # List the environment variables defined on all pods
2560
+  oc set env pods --all --list
2561
+
2562
+  # Output modified build config in YAML, and does not alter the object on the server
2563
+  oc set env bc/sample-build STORAGE_DIR=/data -o yaml
2564
+
2565
+  # Update all containers in all replication controllers in the project to have ENV=prod
2566
+  oc set env rc --all ENV=prod
2567
+
2568
+  # Import environment from a secret
2569
+  oc set env --from=secret/mysecret dc/myapp
2570
+
2571
+  # Import environment from a config map with a prefix
2572
+  oc set env --from=configmap/myconfigmap --prefix=MYSQL_ dc/myapp
2573
+
2574
+  # Remove the environment variable ENV from container 'c1' in all deployment configs
2575
+  oc set env dc --all --containers="c1" ENV-
2576
+
2577
+  # Remove the environment variable ENV from a deployment config definition on disk and
2578
+  # update the deployment config on the server
2579
+  oc set env -f dc.json ENV-
2580
+
2581
+  # Set some of the local shell environment into a deployment config on the server
2582
+  env | grep RAILS_ | oc set env -e - dc/registry
1599 2583
 ----
1600 2584
 ====
1601 2585
 
1602 2586
 
1603
-== <no value>
1604
-<no value>
2587
+== oc set image
2588
+Update image of a pod template
1605 2589
 
1606 2590
 ====
1607 2591
 
1608 2592
 [options="nowrap"]
1609 2593
 ----
1610
-<no value>
2594
+  # Set a deployment configs's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
2595
+  oc set image dc/nginx busybox=busybox nginx=nginx:1.9.1
2596
+
2597
+  # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'
2598
+  oc set image deployments,rc nginx=nginx:1.9.1 --all
2599
+
2600
+  # Update image of all containers of daemonset abc to 'nginx:1.9.1'
2601
+  oc set image daemonset abc *=nginx:1.9.1
2602
+
2603
+  # Print result (in yaml format) of updating nginx container image from local file, without hitting the server
2604
+  oc set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
1611 2605
 ----
1612 2606
 ====
1613 2607
 
1614 2608
 
1615
-== <no value>
1616
-<no value>
2609
+== oc set probe
2610
+Update a probe on a pod template
1617 2611
 
1618 2612
 ====
1619 2613
 
1620 2614
 [options="nowrap"]
1621 2615
 ----
1622
-<no value>
2616
+  # Clear both readiness and liveness probes off all containers
2617
+  oc set probe dc/registry --remove --readiness --liveness
2618
+
2619
+  # Set an exec action as a liveness probe to run 'echo ok'
2620
+  oc set probe dc/registry --liveness -- echo ok
2621
+
2622
+  # Set a readiness probe to try to open a TCP socket on 3306
2623
+  oc set probe rc/mysql --readiness --open-tcp=3306
2624
+
2625
+  # Set an HTTP readiness probe for port 8080 and path /healthz over HTTP on the pod IP
2626
+  oc set probe dc/webapp --readiness --get-url=http://:8080/healthz
2627
+
2628
+  # Set an HTTP readiness probe over HTTPS on 127.0.0.1 for a hostNetwork pod
2629
+  oc set probe dc/router --readiness --get-url=https://127.0.0.1:1936/stats
2630
+
2631
+  # Set only the initial-delay-seconds field on all deployments
2632
+  oc set probe dc --all --readiness --initial-delay-seconds=30
1623 2633
 ----
1624 2634
 ====
1625 2635
 
1626 2636
 
1627
-== <no value>
1628
-<no value>
2637
+== oc set route-backends
2638
+Update the backends for a route
1629 2639
 
1630 2640
 ====
1631 2641
 
1632 2642
 [options="nowrap"]
1633 2643
 ----
1634
-<no value>
2644
+  # Print the backends on the route 'web'
2645
+  oc set route-backends web
2646
+
2647
+  # Set two backend services on route 'web' with 2/3rds of traffic going to 'a'
2648
+  oc set route-backends web a=2 b=1
2649
+
2650
+  # Increase the traffic percentage going to b by 10% relative to a
2651
+  oc set route-backends web --adjust b=+10%
2652
+
2653
+  # Set traffic percentage going to b to 10% of the traffic going to a
2654
+  oc set route-backends web --adjust b=10%
2655
+
2656
+  # Set weight of b to 10
2657
+  oc set route-backends web --adjust b=10
2658
+
2659
+  # Set the weight to all backends to zero
2660
+  oc set route-backends web --zero
1635 2661
 ----
1636 2662
 ====
1637 2663
 
1638 2664
 
1639
-== <no value>
1640
-<no value>
2665
+== oc set triggers
2666
+Update the triggers on a build or deployment config
1641 2667
 
1642 2668
 ====
1643 2669
 
1644 2670
 [options="nowrap"]
1645 2671
 ----
1646
-<no value>
2672
+  # Print the triggers on the registry
2673
+  oc set triggers dc/registry
2674
+
2675
+  # Set all triggers to manual
2676
+  oc set triggers dc/registry --manual
2677
+
2678
+  # Enable all automatic triggers
2679
+  oc set triggers dc/registry --auto
2680
+
2681
+  # Reset the GitHub webhook on a build to a new, generated secret
2682
+  oc set triggers bc/webapp --from-github
2683
+  oc set triggers bc/webapp --from-webhook
2684
+
2685
+  # Remove all triggers
2686
+  oc set triggers bc/webapp --remove-all
2687
+
2688
+  # Stop triggering on config change
2689
+  oc set triggers dc/registry --from-config --remove
2690
+
2691
+  # Add an image trigger to a build config
2692
+  oc set triggers bc/webapp --from-image=namespace1/image:latest
1647 2693
 ----
1648 2694
 ====
1649 2695
 
1650 2696
 
1651
-== <no value>
1652
-<no value>
2697
+== oc set volumes
2698
+Update volumes on a pod template
1653 2699
 
1654 2700
 ====
1655 2701
 
1656 2702
 [options="nowrap"]
1657 2703
 ----
1658
-<no value>
2704
+  # List volumes defined on all deployment configs in the current project
2705
+  oc set volume dc --all
2706
+
2707
+  # Add a new empty dir volume to deployment config (dc) 'registry' mounted under
2708
+  # /var/lib/registry
2709
+  oc set volume dc/registry --add --mount-path=/var/lib/registry
2710
+
2711
+  # Use an existing persistent volume claim (pvc) to overwrite an existing volume 'v1'
2712
+  oc set volume dc/registry --add --name=v1 -t pvc --claim-name=pvc1 --overwrite
2713
+
2714
+  # Remove volume 'v1' from deployment config 'registry'
2715
+  oc set volume dc/registry --remove --name=v1
2716
+
2717
+  # Create a new persistent volume claim that overwrites an existing volume 'v1'
2718
+  oc set volume dc/registry --add --name=v1 -t pvc --claim-size=1G --overwrite
2719
+
2720
+  # Change the mount point for volume 'v1' to /data
2721
+  oc set volume dc/registry --add --name=v1 -m /data --overwrite
2722
+
2723
+  # Modify the deployment config by removing volume mount "v1" from container "c1"
2724
+  # (and by removing the volume "v1" if no other containers have volume mounts that reference it)
2725
+  oc set volume dc/registry --remove --name=v1 --containers=c1
2726
+
2727
+  # Add new volume based on a more complex volume source (Git repo, AWS EBS, GCE PD,
2728
+  # Ceph, Gluster, NFS, ISCSI, ...)
2729
+  oc set volume dc/registry --add -m /repo --source=<json-string>
1659 2730
 ----
1660 2731
 ====
1661 2732
 
1662 2733
 
1663
-== <no value>
1664
-<no value>
2734
+== oc start-build
2735
+Start a new build
1665 2736
 
1666 2737
 ====
1667 2738
 
1668 2739
 [options="nowrap"]
1669 2740
 ----
1670
-<no value>
2741
+  # Starts build from build config "hello-world"
2742
+  oc start-build hello-world
2743
+
2744
+  # Starts build from a previous build "hello-world-1"
2745
+  oc start-build --from-build=hello-world-1
2746
+
2747
+  # Use the contents of a directory as build input
2748
+  oc start-build hello-world --from-dir=src/
2749
+
2750
+  # Send the contents of a Git repository to the server from tag 'v2'
2751
+  oc start-build hello-world --from-repo=../hello-world --commit=v2
2752
+
2753
+  # Start a new build for build config "hello-world" and watch the logs until the build
2754
+  # completes or fails.
2755
+  oc start-build hello-world --follow
2756
+
2757
+  # Start a new build for build config "hello-world" and wait until the build completes. It
2758
+  # exits with a non-zero return code if the build fails.
2759
+  oc start-build hello-world --wait
1671 2760
 ----
1672 2761
 ====
1673 2762
 
1674 2763
 
1675
-== <no value>
1676
-<no value>
2764
+== oc status
2765
+Show an overview of the current project
1677 2766
 
1678 2767
 ====
1679 2768
 
1680 2769
 [options="nowrap"]
1681 2770
 ----
1682
-<no value>
2771
+  # See an overview of the current project.
2772
+  oc status
2773
+
2774
+  # Export the overview of the current project in an svg file.
2775
+  oc status -o dot | dot -T svg -o project.svg
2776
+
2777
+  # See an overview of the current project including details for any identified issues.
2778
+  oc status -v
1683 2779
 ----
1684 2780
 ====
1685 2781
 
1686 2782
 
1687
-== <no value>
1688
-<no value>
2783
+== oc tag
2784
+Tag existing images into image streams
1689 2785
 
1690 2786
 ====
1691 2787
 
1692 2788
 [options="nowrap"]
1693 2789
 ----
1694
-<no value>
2790
+  # Tag the current image for the image stream 'openshift/ruby' and tag '2.0' into the image stream 'yourproject/ruby with tag 'tip'.
2791
+  oc tag openshift/ruby:2.0 yourproject/ruby:tip
2792
+
2793
+  # Tag a specific image.
2794
+  oc tag openshift/ruby@sha256:6b646fa6bf5e5e4c7fa41056c27910e679c03ebe7f93e361e6515a9da7e258cc yourproject/ruby:tip
2795
+
2796
+  # Tag an external Docker image.
2797
+  oc tag --source=docker openshift/origin:latest yourproject/ruby:tip
2798
+
2799
+  # Remove the specified spec tag from an image stream.
2800
+  oc tag openshift/origin:latest -d
1695 2801
 ----
1696 2802
 ====
1697 2803
 
1698 2804
 
1699
-== <no value>
1700
-<no value>
2805
+== oc types
2806
+An introduction to concepts and types
1701 2807
 
1702 2808
 ====
1703 2809
 
1704 2810
 [options="nowrap"]
1705 2811
 ----
1706
-<no value>
2812
+  # View all projects you have access to
2813
+  oc get projects
2814
+
2815
+  # See a list of all services in the current project
2816
+  oc get svc
2817
+
2818
+  # Describe a deployment configuration in detail
2819
+  oc describe dc mydeploymentconfig
2820
+
2821
+  # Show the images tagged into an image stream
2822
+  oc describe is ruby-centos7
1707 2823
 ----
1708 2824
 ====
1709 2825
 
1710 2826
 
1711
-== <no value>
1712
-<no value>
2827
+== oc volumes
2828
+DEPRECATED: set volume
1713 2829
 
1714 2830
 ====
1715 2831
 
1716 2832
 [options="nowrap"]
1717 2833
 ----
1718
-<no value>
2834
+  # List volumes defined on all deployment configs in the current project
2835
+  oc volume dc --all
2836
+
2837
+  # Add a new empty dir volume to deployment config (dc) 'registry' mounted under
2838
+  # /var/lib/registry
2839
+  oc volume dc/registry --add --mount-path=/var/lib/registry
2840
+
2841
+  # Use an existing persistent volume claim (pvc) to overwrite an existing volume 'v1'
2842
+  oc volume dc/registry --add --name=v1 -t pvc --claim-name=pvc1 --overwrite
2843
+
2844
+  # Remove volume 'v1' from deployment config 'registry'
2845
+  oc volume dc/registry --remove --name=v1
2846
+
2847
+  # Create a new persistent volume claim that overwrites an existing volume 'v1'
2848
+  oc volume dc/registry --add --name=v1 -t pvc --claim-size=1G --overwrite
2849
+
2850
+  # Change the mount point for volume 'v1' to /data
2851
+  oc volume dc/registry --add --name=v1 -m /data --overwrite
2852
+
2853
+  # Modify the deployment config by removing volume mount "v1" from container "c1"
2854
+  # (and by removing the volume "v1" if no other containers have volume mounts that reference it)
2855
+  oc volume dc/registry --remove --name=v1 --containers=c1
2856
+
2857
+  # Add new volume based on a more complex volume source (Git repo, AWS EBS, GCE PD,
2858
+  # Ceph, Gluster, NFS, ISCSI, ...)
2859
+  oc volume dc/registry --add -m /repo --source=<json-string>
1719 2860
 ----
1720 2861
 ====
1721 2862