3
3
// Uses 'source,bash' for proper syntax highlighting for comments in examples
4
4
5
5
:_content-type: REFERENCE
6
- [id="microshift-oc- cli-admin_{context} "]
6
+ [id="microshift-cli-admin_{context} "]
7
7
= OpenShift CLI (oc) administrator commands
8
8
9
- //IMPORTANT: QE'd and hand-edited for relevance to MicroShift; use this version to check auto-generated files for 4.14
10
9
11
- //== oc adm build-chain
12
-
13
- == oc adm catalog mirror
14
- Mirror an operator-registry catalog
15
-
16
- .Example usage
17
- [source,bash,options="nowrap"]
18
- ----
19
- # Mirror an operator-registry image and its contents to a registry
20
- oc adm catalog mirror quay.io/my/image:latest myregistry.com
21
-
22
- # Mirror an operator-registry image and its contents to a particular namespace in a registry
23
- oc adm catalog mirror quay.io/my/image:latest myregistry.com/my-namespace
24
-
25
- # Mirror to an airgapped registry by first mirroring to files
26
- oc adm catalog mirror quay.io/my/image:latest file:///local/index
27
- oc adm catalog mirror file:///local/index/my/image:latest my-airgapped-registry.com
28
-
29
- # Configure a cluster to use a mirrored registry
30
- oc apply -f manifests/imageContentSourcePolicy.yaml
31
-
32
- # Edit the mirroring mappings and mirror with "oc image mirror" manually
33
- oc adm catalog mirror --manifests-only quay.io/my/image:latest myregistry.com
34
- oc image mirror -f manifests/mapping.txt
35
-
36
- # Delete all ImageContentSourcePolicies generated by oc adm catalog mirror
37
- oc delete imagecontentsourcepolicy -l operators.openshift.org/catalog=true
38
- ----
39
-
40
- //== oc adm certificate approve
41
- //== oc adm certificate deny
42
- //== oc adm cordon
43
- //== oc adm create-bootstrap-project-template
44
- //== oc adm create-error-template
45
- //== oc adm create-login-template
46
- //== oc adm create-provider-selection-template
47
- //== oc adm drain
48
- //== oc adm groups add-users
49
- //== oc adm groups new
50
- //== oc adm groups prune
51
- //== oc adm groups remove-users
52
- //== oc adm groups sync
53
10
54
11
== oc adm inspect
55
12
Collect debugging data for a given resource
56
- //NOTE: This was hand-edited per QE in 4.13. This section is correct as is.
57
- .Example usage
58
- [source,bash,options="nowrap"]
59
- ----
60
- # Collect debugging data for the "microshift-apiserver"
61
- oc adm inspect service/kubernetes
62
-
63
- # Collect debugging data for the "microshift-apiserver" and "toptlvm-apiserver"
64
- oc adm inspect service/kubernetes crd/logicalvolumes.topolvm.io
65
-
66
- # Collect debugging data for services
67
- oc adm inspect service
68
-
69
- # Collect debugging data for all clusterversions
70
- oc adm inspect service,crd
71
- ----
72
-
73
- == oc adm migrate icsp
74
- Update imagecontentsourcepolicy file(s) to imagedigestmirrorset file(s).
75
-
76
- .Example usage
77
- [source,bash,options="nowrap"]
78
- ----
79
- # update the imagecontentsourcepolicy.yaml to new imagedigestmirrorset file under directory mydir
80
- oc adm migrate icsp imagecontentsourcepolicy.yaml --dest-dir mydir
81
- ----
82
-
83
- //== oc adm migrate template-instances
84
- //== oc adm must-gather
85
- //== oc adm new-project
86
-
87
-
88
- //== oc adm node-logs
89
- Display and filter node logs
90
13
91
14
.Example usage
92
15
[source,bash,options="nowrap"]
93
16
----
94
- # Show kubelet logs from all masters
95
- oc adm node-logs --role master -u kubelet
96
-
97
- # See what logs are available in masters in /var/logs
98
- oc adm node-logs --role master --path=/
99
-
100
- # Display cron log file from all masters
101
- oc adm node-logs --role master --path=cron
17
+ # Collect debugging data for a kubernetes service
18
+ oc adm inspect service/kubernetes
19
+
20
+ # Collect debugging data for a node
21
+ oc adm inspect node/<node_name>
22
+
23
+ # Collect debugging data for logicalvolumes in a CRD
24
+ oc adm inspect crd/logicalvolumes.topolvm.io
25
+
26
+ # Collect debugging data for routes.route.openshift.io in a CRD
27
+ oc adm inspect crd/routes.route.openshift.io
102
28
----
103
29
104
- //== oc adm pod-network isolate-projects
105
- //== oc adm pod-network join-projects
106
- //== oc adm pod-network make-projects-global
107
- //== oc adm policy add-role-to-user
108
- //== oc adm policy add-scc-to-group
109
- //== oc adm policy add-scc-to-user
110
- //== oc adm policy scc-review
111
- //== oc adm policy scc-subject-review
112
- //== oc adm prune builds
113
- //== oc adm prune deployments
114
- //== oc adm prune groups
115
- //== oc adm prune images
116
30
117
31
118
32
== oc adm release extract
@@ -123,12 +37,12 @@ Extract the contents of an update payload to disk
123
37
----
124
38
# Use git to check out the source code for the current cluster release to DIR
125
39
oc adm release extract --git=DIR
126
-
40
+
127
41
# Extract cloud credential requests for AWS
128
42
oc adm release extract --credentials-requests --cloud=aws
129
-
43
+
130
44
# Use git to check out the source code for the current cluster release to DIR from linux/s390x image
131
- # Note: Wildcard filter is not supported. Pass a single os/arch to extract
45
+ # Note: Wildcard filter is not supported; pass a single os/arch to extract
132
46
oc adm release extract --git=DIR quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
133
47
----
134
48
@@ -142,100 +56,44 @@ Display information about a release
142
56
----
143
57
# Show information about the cluster's current release
144
58
oc adm release info
145
-
59
+
146
60
# Show the source code that comprises a release
147
61
oc adm release info 4.11.2 --commit-urls
148
-
62
+
149
63
# Show the source code difference between two releases
150
64
oc adm release info 4.11.0 4.11.2 --commits
151
-
65
+
152
66
# Show where the images referenced by the release are located
153
67
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --pullspecs
154
-
68
+
155
69
# Show information about linux/s390x image
156
- # Note: Wildcard filter is not supported. Pass a single os/arch to extract
70
+ # Note: Wildcard filter is not supported; pass a single os/arch to extract
157
71
oc adm release info quay.io/openshift-release-dev/ocp-release:4.11.2 --filter-by-os=linux/s390x
158
72
----
159
73
160
74
161
75
162
- == oc adm release mirror
163
- Mirror a release to a different image registry location
164
-
165
- .Example usage
166
- [source,bash,options="nowrap"]
167
- ----
168
- # Perform a dry run showing what would be mirrored, including the mirror objects
169
- oc adm release mirror 4.11.0 --to myregistry.local/openshift/release \
170
- --release-image-signature-to-dir /tmp/releases --dry-run
171
-
172
- # Mirror a release into the current directory
173
- oc adm release mirror 4.11.0 --to file://openshift/release \
174
- --release-image-signature-to-dir /tmp/releases
175
-
176
- # Mirror a release to another directory in the default location
177
- oc adm release mirror 4.11.0 --to-dir /tmp/releases
178
-
179
- # Upload a release from the current directory to another server
180
- oc adm release mirror --from file://openshift/release --to myregistry.com/openshift/release \
181
- --release-image-signature-to-dir /tmp/releases
182
-
183
- # Mirror the 4.11.0 release to repository registry.example.com and apply signatures to connected cluster
184
- oc adm release mirror --from=quay.io/openshift-release-dev/ocp-release:4.11.0-x86_64 \
185
- --to=registry.example.com/your/repository --apply-release-image-signature
186
- ----
187
-
188
-
189
- //== oc adm release new
190
-
191
76
== oc adm taint
192
- Update the taints on one or more nodes
77
+ Update the taints on nodes
193
78
194
79
.Example usage
195
80
[source,bash,options="nowrap"]
196
81
----
197
82
# Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and effect 'NoSchedule'
198
83
# If a taint with that key and effect already exists, its value is replaced as specified
199
84
oc adm taint nodes foo dedicated=special-user:NoSchedule
200
-
85
+
201
86
# Remove from node 'foo' the taint with key 'dedicated' and effect 'NoSchedule' if one exists
202
87
oc adm taint nodes foo dedicated:NoSchedule-
203
-
88
+
204
89
# Remove from node 'foo' all the taints with key 'dedicated'
205
90
oc adm taint nodes foo dedicated-
206
-
91
+
207
92
# Add a taint with key 'dedicated' on nodes having label mylabel=X
208
93
oc adm taint node -l myLabel=X dedicated=foo:PreferNoSchedule
209
-
94
+
210
95
# Add to node 'foo' a taint with key 'bar' and no value
211
96
oc adm taint nodes foo bar:NoSchedule
212
97
----
213
98
214
99
215
- //== oc adm top images
216
- //== oc adm top imagestreams
217
- //== oc adm top node
218
-
219
-
220
- == oc adm top pod
221
- Display resource (CPU/memory) usage of pods
222
-
223
- .Example usage
224
- [source,bash,options="nowrap"]
225
- ----
226
- # Show metrics for all pods in the default namespace
227
- oc adm top pod
228
-
229
- # Show metrics for all pods in the given namespace
230
- oc adm top pod --namespace=NAMESPACE
231
-
232
- # Show metrics for a given pod and its containers
233
- oc adm top pod POD_NAME --containers
234
-
235
- # Show metrics for the pods defined by label name=myLabel
236
- oc adm top pod -l name=myLabel
237
- ----
238
-
239
- //== oc adm uncordon
240
- //== oc adm upgrade
241
- //== oc adm verify-image-signature
0 commit comments