1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nodes-cluster-resource-levels-command.adoc

120 lines
2.8 KiB
Plaintext

// Module included in the following assemblies:
//
// * nodes/nodes-cluster-resource-levels.adoc
:_mod-docs-content-type: PROCEDURE
[id="nodes-cluster-resource-levels-command_{context}"]
= Running the OpenShift Cluster Capacity Tool on the command line
[role="_abstract"]
You can run the OpenShift Cluster Capacity Tool from the command line to estimate the number of pods that can be scheduled onto your cluster.
You create a sample pod spec file, which the tool uses for estimating resource usage. The pod spec specifies its resource requirements as `limits` or `requests`. The cluster capacity tool takes the pod's resource requirements into account for its estimation analysis.
.Prerequisites
. Run the OpenShift Cluster Capacity Tool, which is available as a container image from the Red Hat Ecosystem Catalog. See the link in the "Additional resources" section.
. Create a sample pod spec file:
.. Create a YAML file similar to the following:
+
[source,yaml]
----
apiVersion: v1
kind: Pod
metadata:
name: small-pod
labels:
app: guestbook
tier: frontend
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
imagePullPolicy: Always
resources:
limits:
cpu: 150m
memory: 100Mi
requests:
cpu: 150m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
----
.. Create the cluster role:
+
[source,terminal]
----
$ oc create -f <file_name>.yaml
----
For example:
+
[source,terminal]
----
$ oc create -f pod-spec.yaml
----
.Procedure
. From the terminal, log in to the Red Hat Registry:
+
[source,terminal]
----
$ podman login registry.redhat.io
----
. Pull the cluster capacity tool image:
+
[source,terminal]
----
$ podman pull registry.redhat.io/openshift4/ose-cluster-capacity
----
. Run the cluster capacity tool:
+
[source,terminal]
----
$ podman run -v $HOME/.kube:/kube:Z -v $(pwd):/cc:Z ose-cluster-capacity \
/bin/cluster-capacity --kubeconfig /kube/config --<pod_spec>.yaml /cc/<pod_spec>.yaml \
--verbose
----
+
--
where:
<pod_spec>.yaml:: Specifies the pod spec to use.
verbose:: Outputs a detailed description of how many pods can be scheduled on each node in the cluster.
--
+
.Example output
[source,terminal]
----
small-pod pod requirements:
- CPU: 150m
- Memory: 100Mi
The cluster can schedule 88 instance(s) of the pod small-pod.
Termination reason: Unschedulable: 0/5 nodes are available: 2 Insufficient cpu,
3 node(s) had taint {node-role.kubernetes.io/master: }, that the pod didn't
tolerate.
Pod distribution among nodes:
small-pod
- 192.168.124.214: 45 instance(s)
- 192.168.124.120: 43 instance(s)
----
+
In the above example, the number of estimated pods that can be scheduled onto
the cluster is 88.