기본적으로 포드에 ComputeClass 적용

이 문서에서는 ComputeClass를 명시적으로 선택하지 않는 Google Kubernetes Engine (GKE) 포드에 기본적으로 ComputeClass를 적용하는 방법을 보여줍니다. ComputeClass를 네임스페이스 또는 전체 클러스터의 기본값으로 설정할 수 있습니다. 이 문서는 개별 워크로드 및 노드 구성으로 인해 발생하는 수동 오버헤드를 줄이려는 클러스터 관리자를 대상으로 합니다.

이미 커스텀 ComputeClass에 익숙해야 합니다.

기본 ComputeClass 정보

GKE 클러스터 또는 특정 네임스페이스에 기본 ComputeClass가 있도록 구성할 수 있습니다. 구성하는 기본 클래스는 다른 ComputeClass를 선택하지 않는 해당 클러스터 또는 네임스페이스의 모든 포드에 적용됩니다. ComputeClass를 선택하지 않는 포드를 배포하면 GKE는 다음 순서로 기본 ComputeClass를 적용합니다.

  1. 네임스페이스에 기본 ComputeClass가 있는 경우 GKE는 해당 ComputeClass를 선택하도록 포드 사양을 수정합니다.
  2. 네임스페이스에 기본 ComputeClass가 없는 경우 클러스터 수준 기본 클래스가 적용됩니다. GKE는 포드 사양을 수정하지 않습니다.

클러스터 또는 네임스페이스의 기본 ComputeClass를 설정하면 변경사항이 새 포드에만 적용됩니다. 기존 포드는 포드가 다시 생성될 때까지 영향을 받지 않습니다. 이 동작은 ComputeClass에 활성 마이그레이션이 사용 설정되어 있는 경우에도 적용됩니다.

기본 ComputeClass의 activeMigration.optimizeRulePriority 필드가 true로 설정되어 있으면 이 설정이 클러스터의 워크로드에 영향을 줄 수 있습니다. 자세한 내용은 기본 ComputeClass의 활성 마이그레이션을 참조하세요.

시작하기 전에

시작하기 전에 다음 태스크를 수행했는지 확인합니다.

  • Google Kubernetes Engine API를 사용 설정합니다.
  • Google Kubernetes Engine API 사용 설정
  • 이 태스크에 Google Cloud CLI를 사용하려면 gcloud CLI를 설치한 후 초기화합니다. 이전에 gcloud CLI를 설치했으면 gcloud components update 명령어를 실행하여 최신 버전을 가져옵니다. 이전 gcloud CLI 버전에서는 이 문서의 명령어를 실행하지 못할 수 있습니다.
  • 클러스터 또는 네임스페이스 수준에서 기본 ComputeClass 설정을 지원하는 버전을 실행하는 GKE Autopilot 또는 Standard 클러스터가 있어야 합니다. 자세한 내용은 요구사항 섹션을 참조하세요.
  • Standard 모드 클러스터를 사용하는 경우 다음 요구사항 중 하나를 충족하는지 확인합니다.

  • 커스텀 ComputeClass를 네임스페이스의 기본값으로 설정하려면 커스텀 ComputeClass를 배포합니다.

요구사항

  • ComputeClass를 클러스터 수준 기본값으로 설정하려면 클러스터가 GKE 버전 1.33.1-gke.1744000 이상을 실행해야 합니다.
  • ComputeClass를 DaemonSet가 아닌 포드에만 네임스페이스 수준 기본값으로 설정하려면 클러스터가 GKE 버전 1.33.1-gke.1788000 이상을 실행해야 합니다.

필수 역할 및 권한

클러스터 또는 네임스페이스 수준 기본 ComputeClass를 구성하는 데 필요한 권한을 얻으려면 관리자에게프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요. Google Cloud

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

이러한 사전 정의된 역할에는 클러스터 또는 네임스페이스 수준 기본 ComputeClass를 구성하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.

필수 권한

클러스터 또는 네임스페이스 수준 기본 ComputeClass를 구성하려면 다음 권한이 필요합니다.

  • container.customResourceDefinitions.create
  • container.customResourceDefinitions.update
  • container.customResourceDefinitions.get
  • container.customResourceDefinitions.list
  • container.namespaces.get
  • container.namespaces.list
  • container.pods.get
  • container.nodes.get
  • container.nodes.list
  • container.deployments.create
  • container.deployments.get
  • 네임스페이스에 라벨 추가: container.namespaces.update
  • 클러스터 수준 기본 ComputeClass 사용 설정: container.clusters.update

커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.

네임스페이스의 기본 ComputeClass 구성

클러스터의 모든 Kubernetes 네임스페이스에 기본값으로 사용할 ComputeClass의 이름을 주석 처리할 수 있습니다. 해당 네임스페이스에 배포된 포드가 아직 ComputeClass를 선택하지 않은 경우 GKE는 네임스페이스의 기본 클래스를 선택하도록 포드 사양을 수정합니다. 커스텀 또는 기본 제공 ComputeClass를 기본값으로 설정할 수 있습니다.

  • 기본적으로 네임스페이스의 모든 포드에 ComputeClass를 적용하려면 해당 네임스페이스에 cloud.google.com/default-compute-class 라벨을 추가합니다.

    kubectl label namespaces NAMESPACE_NAME \
        cloud.google.com/default-compute-class=COMPUTECLASS_NAME
    

    다음을 바꿉니다.

    • NAMESPACE_NAME: 업데이트할 네임스페이스의 이름입니다.
    • COMPUTECLASS_NAME: 네임스페이스의 기본값으로 설정할 ComputeClass의 이름입니다.

    다음 오류 메시지가 발생하고 명령어가 실패하는 경우 네임스페이스에 이미 기본 ComputeClass가 있습니다.

    error: 'cloud.google.com/default-compute-class' already has a value, and --overwrite is false
    

    이 오류를 해결하려면 네임스페이스의 기본 ComputeClass를 업데이트합니다.

  • 기본적으로 네임스페이스의 모든 DaemonSet가 아닌 포드에 ComputeClass를 적용하려면 해당 네임스페이스에 cloud.google.com/default-compute-class-non-daemonset 라벨을 추가합니다.

    kubectl label namespaces NAMESPACE_NAME \
        cloud.google.com/default-compute-class-non-daemonset=COMPUTECLASS_NAME
    

    다음 오류 메시지가 발생하고 명령어가 실패하는 경우 네임스페이스에 이미 DaemonSet가 아닌 포드의 기본 ComputeClass가 있습니다.

    error: 'cloud.google.com/default-compute-class-non-daemonset' already has a value, and --overwrite is false
    

    이 오류를 해결하려면 네임스페이스의 기본 ComputeClass를 업데이트합니다.

변경사항은 해당 네임스페이스의 모든 새 포드에 적용됩니다. 기존 포드는 영향을 받지 않습니다.

네임스페이스에서 기존 기본 ComputeClass 업데이트

네임스페이스의 기존 기본 ComputeClass를 덮어쓰려면 다음 명령어 중 하나를 실행합니다.

  • 네임스페이스의 모든 포드에 대한 기본 ComputeClass를 업데이트합니다.

    kubectl label namespaces NAMESPACE_NAME   \
        cloud.google.com/default-compute-class=COMPUTECLASS_NAME \
        --overwrite
    

    다음을 바꿉니다.

    • NAMESPACE_NAME: 업데이트할 네임스페이스의 이름입니다.
    • COMPUTECLASS_NAME: 네임스페이스의 새 기본값으로 설정할 ComputeClass의 이름입니다.
  • 네임스페이스에서 DaemonSet가 아닌 포드의 기본 ComputeClass를 덮어씁니다.

    kubectl label namespaces NAMESPACE_NAME \
        cloud.google.com/default-compute-class-non-daemonset=COMPUTECLASS_NAME \
        --overwrite
    

시스템 네임스페이스의 기본 ComputeClass 구성

GKE는 시스템 네임스페이스를 사용하여 모니터링 에이전트와 같은 다양한 관리형 워크로드를 실행합니다. 이러한 관리형 워크로드 중 일부는 클러스터의 모든 노드에서 실행되어 중요한 기능을 제공해야 하는 DaemonSet입니다. 하지만 시스템 네임스페이스에서 DaemonSet가 아닌 포드의 기본 ComputeClass를 지정하여 이러한 포드가 워크로드와 별도로 실행되도록 할 수 있습니다.

시스템 네임스페이스의 기본 ComputeClass를 설정하려면 다음 단계를 따르세요.

  1. 다음 스크립트를 apply-system-cc.sh로 저장합니다. 이 스크립트를 사용하면 권장 ComputeClass 또는 기존 ComputeClass를 시스템 네임스페이스에 적용할 수 있습니다.

    #!/bin/bash
    
    # The recommended default ComputeClass name for system pods.
    DEFAULT_SYSTEM_CC_NAME="system-default-computeclass"
    
    # The YAML manifest for the recommended default ComputeClass for system pods.
    read -r -d '' DEFAULT_CC_YAML << EOF
    apiVersion: cloud.google.com/v1
    kind: ComputeClass
    metadata:
      name: ${DEFAULT_SYSTEM_CC_NAME}
    spec:
      nodePoolAutoCreation:
        enabled: true
      whenUnsatisfiable: ScaleUpAnyway
      priorities:
      - machineFamily: t2d
    EOF
    
    # The label key to apply to namespaces.
    LABEL_KEY="cloud.google.com/default-compute-class-non-daemonset"
    
    
    # List of GKE system namespaces.
    SYSTEM_NAMESPACES=(
      "kube-system"
      "gke-gmp-system"
      "gmp-system"
      "gke-managed-cim"
      "gke-managed-volumepopulator"
      "gke-managed-checkpointing"
      "gkebackup"
      "gke-managed-lustrecsi"
    )
    
    
    # 1. Ask the user for their choice.
    echo "This script sets a default ComputeClass for GKE system namespaces."
    echo "--------------------------------------------------------------------"
    echo "The following ComputeClass is recommended for system Pods:"
    echo ""
    echo "$DEFAULT_CC_YAML"
    echo "--------------------------------------------------------------------"
    read -p "Do you want to use the recommended ComputeClass? (y/N): " user_choice
    
    CC_TO_APPLY=""
    
    # 2. Process the user's choice.
    if [[ "$user_choice" =~ ^[Yy]$ ]]; then
      # Path 1: User chose YES.
      echo "Installing the recommended default ComputeClass '${DEFAULT_SYSTEM_CC_NAME}'..."
    
      if ! echo "$DEFAULT_CC_YAML" | kubectl apply -f -; then
          # If kubectl apply fails, print an error and exit.
          echo "❌ Error: Failed to create the default ComputeClass. An internal error occurred."
          echo "Check for kubectl permissions or other cluster issues and re-run the script."
          exit 1
      fi
      # If the command succeeded, set the name to be used for labeling.
      CC_TO_APPLY="$DEFAULT_SYSTEM_CC_NAME"
    
    else
      read -p "Specify the name of an existing ComputeClass to set as the default for system Pods: " custom_cc_name
    
      # Validate that the user entered a name.
      while [[ -z "$custom_cc_name" ]]; do
        echo "Error: Name cannot be empty."
        read -p "Specify the name of an existing ComputeClass: " custom_cc_name
      done
    
      # Check if the specified ComputeClass actually exists in the cluster.
      echo "--> Verifying that ComputeClass '${custom_cc_name}' exists..."
      if kubectl get computeclass "$custom_cc_name" > /dev/null 2>&1; then
        echo "Verified."
        CC_TO_APPLY="$custom_cc_name"
      else
        echo "Error: ComputeClass '${custom_cc_name}' doesn't exist in the cluster."
        echo "Create the ComputeClass, and then then re-run this script."
        exit 1
      fi
    fi
    
    echo ""
    echo "Labelling system namespaces with ComputeClass: '${CC_TO_APPLY}'"
    echo "--------------------------------------------------------------------"
    
    # 3. Apply the label to all system namespaces.
    for ns in "${SYSTEM_NAMESPACES[@]}"; do
      # Gracefully handle namespaces that don't exist on this specific cluster.
      if kubectl get namespace "${ns}" > /dev/null 2>&1; then
        echo "--> Applying label to namespace: ${ns}"
        kubectl label namespace "${ns}" \
          "${LABEL_KEY}=${CC_TO_APPLY}" --overwrite
      else
        echo "--> Skipping namespace ${ns} (does not exist)"
      fi
    done
    
    echo ""
    echo "✅ Script finished successfully."

    이 스크립트는 시스템 네임스페이스의 DaemonSet가 아닌 포드에만 영향을 주는 cloud.google.com/default-compute-class-non-daemonset 라벨을 사용합니다.

  2. 스크립트를 실행합니다.

    ./apply-system-cc.sh
    

스크립트가 완료되면 모든 새 DaemonSet가 아닌 시스템 포드는 ComputeClass가 이미 있는 경우를 제외하고 기본적으로 지정된 ComputeClass를 사용합니다. 해당 네임스페이스의 기존 포드는 영향을 받지 않습니다. GKE가 새 시스템 네임스페이스를 추가하는 경우 이 스크립트를 다시 실행하여 변경사항을 해당 네임스페이스에 적용합니다.

시스템 네임스페이스의 기본 ComputeClass를 설정 해제하려면 다음 단계를 따르세요.

  1. 다음 스크립트를 unset-system-cc.sh로 저장합니다.

    #!/bin/bash
    
    # The recommended default ComputeClass name for system pods.
    DEFAULT_SYSTEM_CC_NAME="system-default-computeclass"
    
    # The YAML manifest for the recommended default ComputeClass for system pods.
    read -r -d '' DEFAULT_CC_YAML << EOF
    apiVersion: cloud.google.com/v1
    kind: ComputeClass
    metadata:
      name: ${DEFAULT_SYSTEM_CC_NAME}
    spec:
      nodePoolAutoCreation:
        enabled: true
      whenUnsatisfiable: ScaleUpAnyway
      priorities:
      - machineFamily: t2d
    EOF
    
    # The label key to apply to namespaces.
    LABEL_KEY="cloud.google.com/default-compute-class-non-daemonset"
    
    
    # List of GKE system namespaces.
    SYSTEM_NAMESPACES=(
      "kube-system"
      "gke-gmp-system"
      "gmp-system"
      "gke-managed-cim"
      "gke-managed-volumepopulator"
      "gke-managed-checkpointing"
      "gkebackup"
      "gke-managed-lustrecsi"
    )
    
    
    # 1. Ask the user for their choice.
    echo "This script sets a default ComputeClass for GKE system namespaces."
    echo "--------------------------------------------------------------------"
    echo "The following ComputeClass is recommended for system Pods:"
    echo ""
    echo "$DEFAULT_CC_YAML"
    echo "--------------------------------------------------------------------"
    read -p "Do you want to use the recommended ComputeClass? (y/N): " user_choice
    
    CC_TO_APPLY=""
    
    # 2. Process the user's choice.
    if [[ "$user_choice" =~ ^[Yy]$ ]]; then
      # Path 1: User chose YES.
      echo "Installing the recommended default ComputeClass '${DEFAULT_SYSTEM_CC_NAME}'..."
    
      if ! echo "$DEFAULT_CC_YAML" | kubectl apply -f -; then
          # If kubectl apply fails, print an error and exit.
          echo "❌ Error: Failed to create the default ComputeClass. An internal error occurred."
          echo "Check for kubectl permissions or other cluster issues and re-run the script."
          exit 1
      fi
      # If the command succeeded, set the name to be used for labeling.
      CC_TO_APPLY="$DEFAULT_SYSTEM_CC_NAME"
    
    else
      read -p "Specify the name of an existing ComputeClass to set as the default for system Pods: " custom_cc_name
    
      # Validate that the user entered a name.
      while [[ -z "$custom_cc_name" ]]; do
        echo "Error: Name cannot be empty."
        read -p "Specify the name of an existing ComputeClass: " custom_cc_name
      done
    
      # Check if the specified ComputeClass actually exists in the cluster.
      echo "--> Verifying that ComputeClass '${custom_cc_name}' exists..."
      if kubectl get computeclass "$custom_cc_name" > /dev/null 2>&1; then
        echo "Verified."
        CC_TO_APPLY="$custom_cc_name"
      else
        echo "Error: ComputeClass '${custom_cc_name}' doesn't exist in the cluster."
        echo "Create the ComputeClass, and then then re-run this script."
        exit 1
      fi
    fi
    
    echo ""
    echo "Labelling system namespaces with ComputeClass: '${CC_TO_APPLY}'"
    echo "--------------------------------------------------------------------"
    
    # 3. Apply the label to all system namespaces.
    for ns in "${SYSTEM_NAMESPACES[@]}"; do
      # Gracefully handle namespaces that don't exist on this specific cluster.
      if kubectl get namespace "${ns}" > /dev/null 2>&1; then
        echo "--> Applying label to namespace: ${ns}"
        kubectl label namespace "${ns}" \
          "${LABEL_KEY}=${CC_TO_APPLY}" --overwrite
      else
        echo "--> Skipping namespace ${ns} (does not exist)"
      fi
    done
    
    echo ""
    echo "✅ Script finished successfully."
  2. 스크립트를 실행합니다.

    ./unset-system-cc.sh
    

클러스터의 기본 ComputeClass 구성

커스텀 ComputeClass를 전체 클러스터의 기본값으로 설정할 수 있습니다. 이 프로세스에는 클러스터에서 클러스터 수준 기본 ComputeClass를 사용 설정한 후 default라는 ComputeClass를 만드는 작업이 포함됩니다. `default`라는 ComputeClass에서 동일한 우선순위 규칙을 지정하여 기본 제공 Autopilot ComputeClass의 동작을 가져올 수도 있습니다.

클러스터에서 기본 ComputeClass를 올바르게 사용하려면 다음 두 단계를 모두 수행해야 합니다.

  1. 클러스터의 클러스터 수준 기본 ComputeClass 설정을 사용 설정하려면 클러스터를 만들거나 업데이트할 때 --enable-default-compute-class 플래그 를 사용합니다.

    • 클러스터 만들기:

      gcloud container clusters create CLUSTER_NAME \
          --location=CONTROL_PLANE_LOCATION \
          --enable-default-compute-class
      

      다음을 바꿉니다.

      • CLUSTER_NAME: 클러스터 이름입니다.
      • CONTROL_PLANE_LOCATION: 클러스터 컨트롤 플레인의 위치입니다(예: us-central1).
    • 클러스터 업데이트:

      gcloud container clusters update CLUSTER_NAME \
          --location=CONTROL_PLANE_LOCATION \
          --enable-default-compute-class
      

      다음을 바꿉니다.

      • CLUSTER_NAME: 클러스터 이름입니다.
      • CONTROL_PLANE_LOCATION: 클러스터 컨트롤 플레인의 위치입니다(예: us-central1).

    이 단계를 완료하면 GKE는 클러스터에서 default라는 ComputeClass를 찾습니다. default ComputeClass를 설정할 때까지 워크로드에 변경사항이 표시되지 않습니다.

  2. 다음 예와 같이 default라는 ComputeClass를 만듭니다.

    • 다음 ComputeClass는 특정 머신 시리즈를 요청합니다.

      apiVersion: cloud.google.com/v1
      kind: ComputeClass
      metadata:
        name: default
      spec:
        priorities:
        - machineFamily: n4
        - machineFamily: n2
        whenUnsatisfiable: ScaleUpAnyway
        nodePoolAutoCreation:
          enabled: true
      

      이 ComputeClass는 N4 인스턴스를 사용하는 노드를 요청합니다. N4 인스턴스를 사용할 수 없는 경우 ComputeClass는 대신 N2 인스턴스를 요청합니다. ComputeClass CustomResourceDefinition에서 사용 가능한 필드를 사용하여 default ComputeClass를 구성할 수 있습니다.

    • 다음 ComputeClass는 Autopilot 컨테이너 최적화 컴퓨팅 플랫폼을 요청합니다.

      apiVersion: cloud.google.com/v1
      kind: ComputeClass
      metadata:
        name: default
      spec:
        autopilot:
          enabled: true
        priorities:
        - podFamily: general-purpose
        whenUnsatisfiable: ScaleUpAnyway
      

      이 ComputeClass는 DoNotScaleUp 대신 ScaleUpAnyway 값이 있는 whenUnsatisfiable 필드를 제외하고 autopilot 기본 제공 ComputeClass의 동작과 일치합니다. 이 수정은 특정 하드웨어의 노드 선택기를 사용하는 포드에 클러스터 수준 기본 ComputeClass가 적용되어 포드가 보류 상태로 유지되는 상황을 방지하는 데 도움이 됩니다.

      podFamily 우선순위 규칙은 포드를 Autopilot 컨테이너 최적화 컴퓨팅 플랫폼에 배치합니다. 이 우선순위 규칙에는 GKE 버전 1.35.2-gke.1485000 이상이 필요합니다.

  3. 클러스터에서 default ComputeClass를 만듭니다.

    kubectl apply -f PATH_TO_MANIFEST
    

    PATH_TO_MANIFEST를 ComputeClass의 매니페스트 경로로 바꿉니다.

  4. 선택사항: Standard 클러스터에 이미 범용 워크로드의 기본값으로 사용하는 수동으로 만든 노드 풀이 있는 경우 Autopilot ComputeClass를 클러스터 수준 기본값으로 설정한 후 이러한 워크로드를 이동하여 Autopilot 모드에서 실행할 수 있습니다. 이러한 워크로드를 이동하려면 노드 풀의 모든 노드를 차단하고 드레이닝합니다. GKE는 클러스터 수준 기본 ComputeClass를 사용하여 새 보류 중인 포드를 예약합니다.

클러스터 수준 기본 ComputeClass를 설정한 후 GKE는 다음 두 요구사항을 모두 충족하는 노드 풀을 확장합니다.

  • 노드 구성이 default ComputeClass의 구성과 동일합니다.
  • 노드 풀에 다른 ComputeClass의 taint 또는 라벨이 없습니다. GKE는 default ComputeClass의 taint 및 라벨이 있는 노드 풀을 확장할 수 있습니다.

예를 들어 default ComputeClass가 N4 머신 시리즈를 지정하는 경우 GKE는 N4 인스턴스를 사용하고 다른 ComputeClass의 taint 또는 라벨이 없는 기존 노드 풀을 확장할 수 있습니다.

변경사항은 ComputeClass가 아직 없는 클러스터의 모든 새 포드에 적용됩니다. 기존 포드는 클러스터 수준 기본 ComputeClass의 활성 마이그레이션 설정에 따라 영향을 받을 수 있습니다. 자세한 내용은 기본 ComputeClass의 활성 마이그레이션을 참조하세요.

기본 ComputeClass 동작 확인

네임스페이스 또는 클러스터에 설정한 기본 ComputeClass가 예상대로 작동하는지 확인하려면 다음 단계를 따르세요.

  1. 다음 배포 예를 검토합니다.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: helloweb
      labels:
        app: hello
    spec:
      selector:
        matchLabels:
          app: hello
          tier: web
      template:
        metadata:
          labels:
            app: hello
            tier: web
        spec:
          containers:
          - name: hello-app
            image: us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
            ports:
            - containerPort: 8080
            resources:
              requests:
                cpu: 200m

    이 배포는 ComputeClass를 명시적으로 요청하지 않습니다.

  2. 배포를 만듭니다.

    kubectl apply --namespace=NAMESPACE_NAME \
        -f https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes-engine-samples/refs/heads/main/quickstarts/hello-app/manifests/helloweb-deployment.yaml
    

    확인하려는 항목에 따라 NAMESPACE_NAME을 다음 중 하나로 바꿉니다.

    • 기본 ComputeClass가 있는 네임스페이스의 이름입니다.
    • 기본 ComputeClass가 없는 네임스페이스의 이름입니다.

    GKE에서 포드를 실행할 새 노드를 만드는 데 시간이 걸릴 수 있습니다.

  3. 배포 예에서 포드를 실행하는 노드를 식별합니다.

    kubectl get pods --namespace=NAMESPACE_NAME \
        --selector=app=hello -o=wide
    

    출력은 다음과 비슷합니다.

    NAME                        READY   STATUS    RESTARTS   AGE     IP          NODE                                                  NOMINATED NODE   READINESS GATES
    helloweb-7795fbf856-58n5l   1/1     Running   0          9m21s   10.52.2.3   gke-cluster-1-nap-n2-highcpu-2-3muqi8-f213e529-rx7d   <none>           <none>
    
  4. 노드 라벨을 가져옵니다.

    kubectl get node NODE_NAME --show-labels \
        | grep "cloud.google.com/compute-class"
    

    NODE_NAME을 이전 단계의 출력에서 노드 이름으로 바꿉니다.

    출력은 다음과 비슷합니다.

    NODE_NAME   Ready    <none>   22m   v1.32.4-gke.1236007
    # lines are omitted from this output
    cloud.google.com/compute-class=COMPUTECLASS_NAME,cloud.google.com/gke-boot-disk=pd-balanced,cloud.google.com/gke-container-runtime=containerd
    

    COMPUTECLASS_NAME의 값은 다음 중 하나입니다.

    • 클러스터 수준 기본 ComputeClass: GKE Autopilot 또는 노드 풀 자동 생성으로 만든 노드의 default입니다. 기존 수동으로 만든 노드 풀의 노드에는 cloud.google.com/compute-class 라벨이 없을 수 있습니다.
    • 네임스페이스 수준 기본 ComputeClass: 네임스페이스 기본값으로 구성한 ComputeClass 의 이름입니다 .

기본 ComputeClass 사용 중지

네임스페이스 또는 클러스터에서 기본 ComputeClass를 사용 중지하려면 다음 중 하나를 수행합니다.

  • 모든 포드의 네임스페이스 수준 기본 ComputeClass를 사용 중지하려면 네임스페이스에서 cloud.google.com/default-compute-class 라벨을 삭제합니다.

    kubectl label namespaces NAMESPACE_NAME \
      cloud.google.com/default-compute-class-
    

    라벨 키 끝에 있는 - 문자는 Kubernetes API의 Namespace 객체에서 해당 키가 있는 라벨을 삭제합니다.

  • DaemonSet가 아닌 포드의 네임스페이스 수준 기본 ComputeClass를 사용 중지하려면 네임스페이스에서 cloud.google.com/default-compute-class-non-daemonset 라벨을 삭제합니다.

    kubectl label namespaces NAMESPACE_NAME \
      cloud.google.com/default-compute-class-non-daemonset-
    
  • 클러스터 수준 기본 ComputeClass를 사용 중지하려면 --no-enable-default-compute-class 플래그와 함께 gcloud container clusters update 명령어를 사용합니다.

    gcloud container clusters update CLUSTER_NAME \
        --location=CONTROL_PLANE_LOCATION \
        --no-enable-default-compute-class
    

다음 단계