7.2.2. 명령줄에서 클러스터 용량 툴 실행

명령줄에서 OpenShift Container Platform 클러스터 용량 툴을 실행하여 클러스터에 예약할 수 있는 Pod의 수를 추정할 수 있습니다.

사전 요구 사항

  • Red Hat Ecosystem Catalog에서 컨테이너 이미지로 사용할 수 있는 OpenShift 클러스터 용량 툴 을 실행합니다.
  • 툴에서 리소스 사용량을 추정하는 데 사용하는 샘플 Pod 사양 파일을 생성합니다. podspec은 리소스 요구 사항을 limits 또는 requests로 지정합니다. 클러스터 용량 툴에서는 추정 분석에 Pod의 리소스 요구 사항을 고려합니다.

    다음은 Pod 사양 입력 예제입니다.

    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

절차

명령줄에서 클러스터 용량 툴을 사용하려면 다음을 수행합니다.

  1. 터미널에서 Red Hat 레지스트리에 로그인합니다.

    $ podman login registry.redhat.io
  2. 클러스터 용량 도구 이미지를 가져옵니다.

    $ podman pull registry.redhat.io/openshift4/ose-cluster-capacity
  3. 클러스터 용량 툴을 실행합니다.

    $ podman run -v $HOME/.kube:/kube:Z -v $(pwd):/cc:Z  ose-cluster-capacity \
    /bin/cluster-capacity --kubeconfig /kube/config --podspec /cc/pod-spec.yaml \
    --verbose 1
    1
    클러스터의 각 노드에서 예약할 수 있는 Pod 수에 대한 자세한 설명을 출력하기 위해 --verbose 옵션을 추가할 수도 있습니다.

    출력 예

    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)

    위의 예에서 클러스터에 예약할 수 있는 예상 Pod 수는 88입니다.