@@ -187,9 +187,8 @@ Check whether an action is allowed
187
187
# Check to see if I can list deployments in my current namespace
188
188
oc auth can-i list deployments.apps
189
189
190
- # Check to see if service account "foo" of namespace "dev" can list pods
191
- # in the namespace "prod".
192
- # You must be allowed to use impersonation for the global option "--as".
190
+ # Check to see if service account "foo" of namespace "dev" can list pods in the namespace "prod"
191
+ # You must be allowed to use impersonation for the global option "--as"
193
192
oc auth can-i list pods --as=system:serviceaccount:dev:foo -n prod
194
193
195
194
# Check to see if I can do everything in my current namespace ("*" means all)
@@ -204,6 +203,9 @@ Check whether an action is allowed
204
203
# Check to see if I can access the URL /logs/
205
204
oc auth can-i get /logs/
206
205
206
+ # Check to see if I can approve certificates.k8s.io
207
+ oc auth can-i approve certificates.k8s.io
208
+
207
209
# List all allowed actions in namespace "foo"
208
210
oc auth can-i --list --namespace=foo
209
211
----
@@ -228,10 +230,10 @@ Experimental: Check self subject attributes
228
230
.Example usage
229
231
[source,bash,options="nowrap"]
230
232
----
231
- # Get your subject attributes.
233
+ # Get your subject attributes
232
234
oc auth whoami
233
235
234
- # Get your subject attributes in JSON format.
236
+ # Get your subject attributes in JSON format
235
237
oc auth whoami -o json
236
238
----
237
239
@@ -1032,7 +1034,7 @@ Create a role binding for a particular role or cluster role
1032
1034
# Create a role binding for user1, user2, and group1 using the admin cluster role
1033
1035
oc create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1
1034
1036
1035
- # Create a role binding for serviceaccount monitoring:sa-dev using the admin role
1037
+ # Create a role binding for service account monitoring:sa-dev using the admin role
1036
1038
oc create rolebinding admin-binding --role=admin --serviceaccount=monitoring:sa-dev
1037
1039
----
1038
1040
@@ -1097,7 +1099,7 @@ Create a secret for use with a Docker registry
1097
1099
oc create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
1098
1100
1099
1101
# Create a new secret named my-secret from ~/.docker/config.json
1100
- oc create secret docker-registry my-secret --from-file=.dockerconfigjson= path/to/.docker/config.json
1102
+ oc create secret docker-registry my-secret --from-file=path/to/.docker/config.json
1101
1103
----
1102
1104
1103
1105
@@ -1324,6 +1326,9 @@ Delete resources by file names, stdin, resources and names, or by resources and
1324
1326
1325
1327
# Delete all pods
1326
1328
oc delete pods --all
1329
+
1330
+ # Delete all pods only if the user confirms the deletion
1331
+ oc delete pods --all --interactive
1327
1332
----
1328
1333
1329
1334
@@ -1565,6 +1570,12 @@ Display one or many resources
1565
1570
1566
1571
# List the 'status' subresource for a single pod
1567
1572
oc get pod web-pod-13je7 --subresource status
1573
+
1574
+ # List all deployments in namespace 'backend'
1575
+ oc get deployments.apps --namespace backend
1576
+
1577
+ # List all pods existing in all namespaces
1578
+ oc get pods --all-namespaces
1568
1579
----
1569
1580
1570
1581
@@ -2060,6 +2071,21 @@ Update fields of a resource
2060
2071
2061
2072
2062
2073
2074
+ == oc plugin
2075
+ Provides utilities for interacting with plugins
2076
+
2077
+ .Example usage
2078
+ [source,bash,options="nowrap"]
2079
+ ----
2080
+ # List all available plugins
2081
+ oc plugin list
2082
+
2083
+ # List only binary names of available plugins without paths
2084
+ oc plugin list --name-only
2085
+ ----
2086
+
2087
+
2088
+
2063
2089
== oc plugin list
2064
2090
List all visible plugin executables on a user's PATH
2065
2091
@@ -2068,6 +2094,9 @@ List all visible plugin executables on a user's PATH
2068
2094
----
2069
2095
# List all available plugins
2070
2096
oc plugin list
2097
+
2098
+ # List only binary names of available plugins without paths
2099
+ oc plugin list --name-only
2071
2100
----
2072
2101
2073
2102
@@ -2305,6 +2334,27 @@ Revert part of an application back to a previous deployment
2305
2334
2306
2335
2307
2336
2337
+ == oc rollout
2338
+ Manage the rollout of a resource
2339
+
2340
+ .Example usage
2341
+ [source,bash,options="nowrap"]
2342
+ ----
2343
+ # Roll back to the previous deployment
2344
+ oc rollout undo deployment/abc
2345
+
2346
+ # Check the rollout status of a daemonset
2347
+ oc rollout status daemonset/foo
2348
+
2349
+ # Restart a deployment
2350
+ oc rollout restart deployment/abc
2351
+
2352
+ # Restart deployments with the 'app=nginx' label
2353
+ oc rollout restart deployment --selector=app=nginx
2354
+ ----
2355
+
2356
+
2357
+
2308
2358
== oc rollout cancel
2309
2359
Cancel the in-progress deployment
2310
2360
@@ -2324,10 +2374,10 @@ View rollout history
2324
2374
[source,bash,options="nowrap"]
2325
2375
----
2326
2376
# View the rollout history of a deployment
2327
- oc rollout history dc/nginx
2377
+ oc rollout history deployment/abc
2328
2378
2329
- # View the details of deployment revision 3
2330
- oc rollout history dc/nginx --revision=3
2379
+ # View the details of daemonset revision 3
2380
+ oc rollout history daemonset/abc --revision=3
2331
2381
----
2332
2382
2333
2383
@@ -2353,10 +2403,10 @@ Mark the provided resource as paused
2353
2403
.Example usage
2354
2404
[source,bash,options="nowrap"]
2355
2405
----
2356
- # Mark the nginx deployment as paused. Any current state of
2357
- # the deployment will continue its function, new updates to the deployment will not
2358
- # have an effect as long as the deployment is paused
2359
- oc rollout pause dc /nginx
2406
+ # Mark the nginx deployment as paused
2407
+ # Any current state of the deployment will continue its function; new updates
2408
+ # to the deployment will not have an effect as long as the deployment is paused
2409
+ oc rollout pause deployment /nginx
2360
2410
----
2361
2411
2362
2412
@@ -2367,7 +2417,7 @@ Restart a resource
2367
2417
.Example usage
2368
2418
[source,bash,options="nowrap"]
2369
2419
----
2370
- # Restart all deployments in test-namespace namespace
2420
+ # Restart all deployments in the test-namespace namespace
2371
2421
oc rollout restart deployment -n test-namespace
2372
2422
2373
2423
# Restart a deployment
@@ -2389,7 +2439,7 @@ Resume a paused resource
2389
2439
[source,bash,options="nowrap"]
2390
2440
----
2391
2441
# Resume an already paused deployment
2392
- oc rollout resume dc /nginx
2442
+ oc rollout resume deployment /nginx
2393
2443
----
2394
2444
2395
2445
@@ -2413,8 +2463,8 @@ Show the status of the rollout
2413
2463
.Example usage
2414
2464
[source,bash,options="nowrap"]
2415
2465
----
2416
- # Watch the status of the latest rollout
2417
- oc rollout status dc /nginx
2466
+ # Watch the rollout status of a deployment
2467
+ oc rollout status deployment /nginx
2418
2468
----
2419
2469
2420
2470
@@ -2426,10 +2476,13 @@ Undo a previous rollout
2426
2476
[source,bash,options="nowrap"]
2427
2477
----
2428
2478
# Roll back to the previous deployment
2429
- oc rollout undo dc/nginx
2479
+ oc rollout undo deployment/abc
2430
2480
2431
- # Roll back to deployment revision 3. The replication controller for that version must exist
2432
- oc rollout undo dc/nginx --to-revision=3
2481
+ # Roll back to daemonset revision 3
2482
+ oc rollout undo daemonset/abc --to-revision=3
2483
+
2484
+ # Roll back to the previous deployment with dry-run
2485
+ oc rollout undo --dry-run=server deployment/abc
2433
2486
----
2434
2487
2435
2488
@@ -3035,9 +3088,13 @@ Experimental: Wait for a specific condition on one or many resources
3035
3088
# Wait for pod "busybox1" to be Ready
3036
3089
oc wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
3037
3090
3038
- # Wait for the service "loadbalancer" to have ingress.
3091
+ # Wait for the service "loadbalancer" to have ingress
3039
3092
oc wait --for=jsonpath='{.status.loadBalancer.ingress}' service/loadbalancer
3040
3093
3094
+ # Wait for the secret "busybox1" to be created, with a timeout of 30s
3095
+ oc create secret generic busybox1
3096
+ oc wait --for=create secret/busybox1 --timeout=30s
3097
+
3041
3098
# Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command
3042
3099
oc delete pod/busybox1
3043
3100
oc wait --for=delete pod/busybox1 --timeout=60s
0 commit comments