@@ -91,6 +91,9 @@ Apply a configuration to a resource by file name or stdin
9191 # Apply the JSON passed into stdin to a pod
9292 cat pod.json | oc apply -f -
9393
94+ # Apply the configuration from all files that end with '.json' - i.e. expand wildcard characters in file names
95+ oc apply -f '*.json'
96+
9497 # Note: --prune is still in Alpha
9598 # Apply the configuration in manifest.yaml that matches label app=nginx and delete all other resources that are not in the file and match label app=nginx
9699 oc apply --prune -f manifest.yaml -l app=nginx
@@ -474,11 +477,14 @@ Set a cluster entry in kubeconfig
474477 # Embed certificate authority data for the e2e cluster entry
475478 oc config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
476479
477- # Disable cert checking for the dev cluster entry
480+ # Disable cert checking for the e2e cluster entry
478481 oc config set-cluster e2e --insecure-skip-tls-verify=true
479482
480483 # Set custom TLS server name to use for validation for the e2e cluster entry
481484 oc config set-cluster e2e --tls-server-name=my-cluster-name
485+
486+ # Set proxy url for the e2e cluster entry
487+ oc config set-cluster e2e --proxy-url=https://1.2.3.4
482488----
483489
484490
@@ -626,8 +632,8 @@ Create a resource from a file or from stdin
626632 # Create a pod based on the JSON passed into stdin
627633 cat pod.json | oc create -f -
628634
629- # Edit the data in docker- registry.yaml in JSON then create the resource using the edited data
630- oc create -f docker- registry.yaml --edit -o json
635+ # Edit the data in registry.yaml in JSON then create the resource using the edited data
636+ oc create -f registry.yaml --edit -o json
631637----
632638
633639
@@ -1124,6 +1130,33 @@ Create a service account with the specified name
11241130
11251131
11261132
1133+ == oc create token
1134+ Request a service account token
1135+
1136+ .Example usage
1137+ [source,bash,options="nowrap"]
1138+ ----
1139+ # Request a token to authenticate to the kube-apiserver as the service account "myapp" in the current namespace
1140+ oc create token myapp
1141+
1142+ # Request a token for a service account in a custom namespace
1143+ oc create token myapp --namespace myns
1144+
1145+ # Request a token with a custom expiration
1146+ oc create token myapp --duration 10m
1147+
1148+ # Request a token with a custom audience
1149+ oc create token myapp --audience https://example.com
1150+
1151+ # Request a token bound to an instance of a Secret object
1152+ oc create token myapp --bound-object-kind Secret --bound-object-name mysecret
1153+
1154+ # Request a token bound to an instance of a Secret object with a specific uid
1155+ oc create token myapp --bound-object-kind Secret --bound-object-name mysecret --bound-object-uid 0d4691ed-659b-4935-a832-355f77ee47cc
1156+ ----
1157+
1158+
1159+
11271160== oc create user
11281161Manually create a user (only needed if automatic creation is disabled)
11291162
@@ -1196,6 +1229,9 @@ Delete resources by file names, stdin, resources and names, or by resources and
11961229 # Delete resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml
11971230 oc delete -k dir
11981231
1232+ # Delete resources from all files that end with '.json' - i.e. expand wildcard characters in file names
1233+ oc apply -f '*.json'
1234+
11991235 # Delete a pod based on the type and name in the JSON passed into stdin
12001236 cat pod.json | oc delete -f -
12011237
@@ -1266,17 +1302,20 @@ Edit a resource on the server
12661302.Example usage
12671303[source,bash,options="nowrap"]
12681304----
1269- # Edit the service named 'docker- registry'
1270- oc edit svc/docker- registry
1305+ # Edit the service named 'registry'
1306+ oc edit svc/registry
12711307
12721308 # Use an alternative editor
1273- KUBE_EDITOR="nano" oc edit svc/docker- registry
1309+ KUBE_EDITOR="nano" oc edit svc/registry
12741310
12751311 # Edit the job 'myjob' in JSON using the v1 API format
12761312 oc edit job.v1.batch/myjob -o json
12771313
12781314 # Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation
12791315 oc edit deployment/mydeployment -o yaml --save-config
1316+
1317+ # Edit the deployment/mydeployment's status subresource
1318+ oc edit deployment mydeployment --subresource='status'
12801319----
12811320
12821321
@@ -1352,13 +1391,6 @@ Expose a replicated application as a service or route
13521391
13531392 # Expose a service as a route in the specified path
13541393 oc expose service nginx --path=/nginx
1355-
1356- # Expose a service using different generators
1357- oc expose service nginx --name=exposed-svc --port=12201 --protocol="TCP" --generator="service/v2"
1358- oc expose service nginx --name=my-route --port=12201 --generator="route/v1"
1359-
1360- # Exposing a service using the "route/v1" generator (default) will create a new exposed route with the "--name" provided
1361- # (or the name of the service otherwise). You may not specify a "--protocol" or "--target-port" option when using this generator
13621394----
13631395
13641396
@@ -1422,6 +1454,9 @@ Display one or many resources
14221454
14231455 # List one or more resources by their type and names
14241456 oc get rc/web service/frontend pods/web-pod-13je7
1457+
1458+ # List status subresource for a single pod.
1459+ oc get pod web-pod-13je7 --subresource status
14251460----
14261461
14271462
@@ -1867,6 +1902,21 @@ Update fields of a resource
18671902
18681903 # Update a container's image using a JSON patch with positional arrays
18691904 oc patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
1905+
1906+ # Update a deployment's replicas through the scale subresource using a merge patch.
1907+ oc patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{"spec":{"replicas":2}}'
1908+ ----
1909+
1910+
1911+
1912+ == oc plugin list
1913+ List all visible plugin executables on a user's PATH
1914+
1915+ .Example usage
1916+ [source,bash,options="nowrap"]
1917+ ----
1918+ # List all available plugins
1919+ oc plugin list
18701920----
18711921
18721922
@@ -2065,9 +2115,6 @@ Log in to the integrated registry
20652115 # Log in to the integrated registry
20662116 oc registry login
20672117
2068- # Log in as the default service account in the current namespace
2069- oc registry login -z default
2070-
20712118 # Log in to different registry using BASIC auth credentials
20722119 oc registry login --registry quay.io/myregistry --auth-basic=USER:PASS
20732120----
@@ -2186,6 +2233,9 @@ Restart a resource
21862233
21872234 # Restart a daemon set
21882235 oc rollout restart daemonset/abc
2236+
2237+ # Restart deployments with the app=nginx label
2238+ oc rollout restart deployment --selector=app=nginx
21892239----
21902240
21912241
@@ -2369,46 +2419,6 @@ Detach secrets from a service account
23692419
23702420
23712421
2372- == oc serviceaccounts create-kubeconfig
2373- Generate a kubeconfig file for a service account
2374-
2375- .Example usage
2376- [source,bash,options="nowrap"]
2377- ----
2378- # Create a kubeconfig file for service account 'default'
2379- oc serviceaccounts create-kubeconfig 'default' > default.kubeconfig
2380- ----
2381-
2382-
2383-
2384- == oc serviceaccounts get-token
2385- Get a token assigned to a service account
2386-
2387- .Example usage
2388- [source,bash,options="nowrap"]
2389- ----
2390- # Get the service account token from service account 'default'
2391- oc serviceaccounts get-token 'default'
2392- ----
2393-
2394-
2395-
2396- == oc serviceaccounts new-token
2397- Generate a new token for a service account
2398-
2399- .Example usage
2400- [source,bash,options="nowrap"]
2401- ----
2402- # Generate a new token for service account 'default'
2403- oc serviceaccounts new-token 'default'
2404-
2405- # Generate a new token for service account 'default' and apply
2406- # labels 'foo' and 'bar' to the new token for identification
2407- oc serviceaccounts new-token 'default' --labels foo=foo-value,bar=bar-value
2408- ----
2409-
2410-
2411-
24122422== oc set build-hook
24132423Update a build hook on a build config
24142424
@@ -2871,7 +2881,7 @@ Experimental: Wait for a specific condition on one or many resources
28712881 # Wait for the pod "busybox1" to contain the status condition of type "Ready"
28722882 oc wait --for=condition=Ready pod/busybox1
28732883
2874- # The default value of status condition is true; you can set it to false
2884+ # The default value of status condition is true; you can wait for other targets after an equal delimiter (compared after Unicode simple case folding, which is a more general form of case-insensitivity):
28752885 oc wait --for=condition=Ready=false pod/busybox1
28762886
28772887 # Wait for the pod "busybox1" to contain the status phase to be "Running".
0 commit comments