Skip to content

Latest commit

 

History

History
85 lines (72 loc) · 2.22 KB

nodes-cluster-resource-levels-command.adoc

File metadata and controls

85 lines (72 loc) · 2.22 KB

Running the cluster capacity tool on the command line

You can run the {product-title} cluster capacity tool from the command line to estimate the number of pods that can be scheduled onto your cluster.

Prerequisites
  • Download and install the cluster-capacity tool.

  • Create a sample pod specification file, which the tool uses for estimating resource usage. The podspec specifies its resource requirements as limits or requests. The cluster capacity tool takes the pod’s resource requirements into account for its estimation analysis.

    An example of the pod specification input is:

    apiVersion: v1
    kind: Pod
    metadata:
      name: small-pod
      labels:
        app: guestbook
        tier: frontend
    spec:
      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
Procedure

To run the tool on the command line:

  1. Run the following command:

    $ ./cluster-capacity --kubeconfig <path-to-kubeconfig> \ (1)
        --podspec <path-to-pod-spec> (2)
    1. Specify the path to your Kubernetes configuration file.

    2. Specify the path to the sample pod specification file

      You can also add the --verbose option to output a detailed description of how many pods can be scheduled on each node in the cluster:

      $ ./cluster-capacity --kubeconfig <path-to-kubeconfig> \
          --podspec <path-to-pod-spec> --verbose
  2. View the output, which looks similar to the following:

    small-pod pod requirements:
    	- CPU: 150m
    	- Memory: 100Mi
    
    The cluster can schedule 52 instance(s) of the pod small-pod.
    
    Termination reason: Unschedulable: No nodes are available that match all of the
    following predicates:: Insufficient cpu (2).
    
    Pod distribution among nodes:
    small-pod
    	- 192.168.124.214: 26 instance(s)
    	- 192.168.124.120: 26 instance(s)

    In the above example, the number of estimated pods that can be scheduled onto the cluster is 52.