Skip to content

Commit 9a69615

Browse files
authored
Merge pull request #90971 from lpettyjo/OSDOCS-12099
OSDOCS-12099#Add CLI cmd for PVC usage
2 parents 3c1ab27 + 68e9631 commit 9a69615

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

modules/storage-persistent-storage-pvc.adoc

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,84 @@ spec:
113113
<1> Path to mount the volume inside the pod.
114114
<2> Name of the volume to mount. Do not mount to the container root, `/`, or any path that is the same in the host and the container. This can corrupt your host system if the container is sufficiently privileged, such as the host `/dev/pts` files. It is safe to mount the host by using `/host`.
115115
<3> Name of the PVC, that exists in the same namespace, to use.
116+
117+
[id="pvc-cli-command-usage_{context}"]
118+
== Viewing PVC usage statistics
119+
120+
You can view usage statistics for persistent volume claims (PVCs).
121+
122+
:FeatureName: PVC usage statistics command
123+
include::snippets/technology-preview.adoc[leveloffset=+1]
124+
125+
=== User permissions required to view PVC usage statistics
126+
To view PVC usage statistics, you must have the necessary privileges.
127+
128+
To log on with the necessary privileges:
129+
130+
* If you have admin privileges, log on as an admin.
131+
132+
* If you do _not_ have admin privileges:
133+
134+
. Create and add cluster roles to the user by running the following commands:
135+
+
136+
[source,terminal]
137+
----
138+
$ oc create clusterrole routes-view --verb=get,list --resource=routes
139+
$ oc admin policy add-cluster-role-to-user routes-view <user-name> <1>
140+
$ oc admin policy add-cluster-role-to-user cluster-monitoring-view <user-name> <1>
141+
----
142+
<1> The user's name.
143+
144+
=== Viewing PVC usage statistics
145+
146+
* To view statistics across a cluster, run the following command:
147+
+
148+
[source, terminal]
149+
----
150+
$ oc adm top pvc -A
151+
----
152+
+
153+
.Example command output
154+
[source, terminal]
155+
----
156+
NAMESPACE NAME USAGE(%)
157+
namespace-1 data-etcd-1 3.82%
158+
namespace-1 data-etcd-0 3.81%
159+
namespace-1 data-etcd-2 3.81%
160+
namespace-2 mypvc-fs-gp3 0.00%
161+
default mypvc-fs 98.36%
162+
----
163+
164+
* To view PVC usage statistics for a specified namespace, run the following command:
165+
+
166+
[source, terminal]
167+
----
168+
$ oc adm top pvc -n <namespace-name> <1>
169+
----
170+
<1> Where `<namespace-name>` is the name of the specified namespace.
171+
+
172+
.Example command output
173+
[source, terminal]
174+
----
175+
NAMESPACE NAME USAGE(%)
176+
namespace-1 data-etcd-2 3.81% <1>
177+
namespace-1 data-etcd-0 3.81%
178+
namespace-1 data-etcd-1 3.82%
179+
----
180+
<1> In this example, the specified namespace is `namespace-1`.
181+
182+
* To view usage statistics for a specified PVC and for a specified namespace, run the following command:
183+
+
184+
[source, terminal]
185+
----
186+
$ oc adm top pvc <pvc-name> -n <namespace-name> <1>
187+
----
188+
<1> Where `<pvc-name>` is the name of specified PVC and `<namespace-name>` is the name of the specified namespace.
189+
+
190+
.Example command output
191+
[source, terminal]
192+
----
193+
NAMESPACE NAME USAGE(%)
194+
namespace-1 data-etcd-0 3.81% <1>
195+
----
196+
<1> In this example, the specified namespace is `namespace-1` and the specified PVC is `data-etcd-0`.

0 commit comments

Comments
 (0)