1.10. 클러스터 API


클러스터 API는 Kubernetes 클러스터의 프로비저닝, 업그레이드 및 관리를 단순화하는 선언적 API를 제공합니다. 다중 클러스터 엔진 Operator는 여러 인프라 및 부트스트랩 공급자와 함께 코어 클러스터 API 구성 요소를 설치하여 다양한 사용 사례 및 플랫폼을 지원합니다. 독립 실행형 다중 클러스터 엔진 Operator 또는 Red Hat Advanced Cluster Management를 사용하여 Cluster API를 사용하는 방법을 알아봅니다. 다음 프로세스를 참조하십시오.

1.10.1. 클러스터 API를 사용하여 관리형 클러스터 설치

metal3 인프라 공급자와 OpenShift Container Platform 지원 부트스트랩 및 컨트롤 플레인 공급자를 사용하여 클러스터 API로 OpenShift Container Platform 관리 클러스터를 설치할 수 있습니다.

  • 'ControlPlane'은 컨트롤 플레인 속성을 정의합니다.
  • ClusterInfrastructure 는 클러스터 수준 인프라 세부 정보를 정의합니다.

사전 요구 사항

  • Red Hat Advanced Cluster Management 설치 또는 다중 클러스터 엔진 Operator 독립 실행형 설치의 MultiClusterEngine 리소스가 필요합니다.
  • 다음 API 기본 도메인은 정적 API VIP를 가리켜야 합니다 . api.<cluster_name>.<base_domain > .
  • 다음 애플리케이션 기본 도메인은 Ingress VIP의 고정 IP 주소를 가리켜야 합니다 . *.apps.<cluster_name>.<base_domain > .
  • 클러스터의 내부 API 끝점( api-int.<baseDomain>)이 필요합니다.

1.10.1.1. 클러스터 API를 사용하여 워크로드 프로비저닝

  1. 워크로드를 프로비저닝하는 데 필요한 서비스를 활성화합니다. 기본적으로 assisted-service 가 활성화됩니다. 기본적으로 cluster-api-provider-metal3-preview 및 cluster-api-provider-openshift-assisted-preview 는 비활성화되어 있습니다. 세 가지 서비스 모두 true 임을 확인합니다. 다음 명령을 실행하여 리소스를 편집합니다.

    oc edit multiclusterengines.multicluster.openshift.io -n multicluster-engine
    Copy to Clipboard Toggle word wrap
  2. assisted-service 구성 요소, cluster-api-provider-metal3-preview 구성 요소, cluster-api-provider-openshift-assisted-preview 구성 요소의 .spec.overrides 에서 enabled: true 를 설정합니다. 다음 configOverrides 값을 참조하십시오.

        - configOverrides: {}
          enabled: true
          name: assisted-service
        - configOverrides: {}
          enabled: true
          name: cluster-api
    ...
        - configOverrides: {}
          enabled: true
          name: cluster-api-provider-metal3-preview
        - configOverrides: {}
          enabled: true
          name: cluster-api-provider-openshift-assisted-preview
    Copy to Clipboard Toggle word wrap
  3. 중앙 인프라 관리 서비스를 활성화합니다. 절차 를 보려면 중앙 인프라 관리 서비스 활성화를 참조하십시오.
  4. clusterNetwork 사양, controlPlaneRef 사양 및 infrastructureRef 사양을 사용하여 클러스터 리소스를 구성합니다. 다음 Cluster 리소스를 참조하십시오.

    apiVersion: cluster.x-k8s.io/v1beta1
    kind: Cluster
    metadata:
      name: <cluster-name>
      namespace: <cluster-namespace>
    spec:
      clusterNetwork:
        pods:
          cidrBlocks:
            - 172.18.0.0/20
        services:
          cidrBlocks:
            - 10.96.0.0/12
      controlPlaneRef: 
    1
    
        apiVersion: controlplane.cluster.x-k8s.io/v1alpha2
        kind: OpenshiftAssistedControlPlane
        name:  <cluster-name>
        namespace:  <cluster-namespace>
      infrastructureRef: 
    2
    
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: Metal3Cluster
        name: <cluster-name>
        namespace: <cluster-namespace>
    Copy to Clipboard Toggle word wrap
    1
    OpenshiftAssistedControlPlane 는 컨트롤 플레인입니다.
    2
    Metal3Cluster 는 인프라입니다.
  5. 다음 명령을 실행하여 YAML 콘텐츠를 적용합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  6. distributionVersion,apiVIPs 및 SSH 키를 포함하는 OpenshiftAssistedControlPlane 리소스를 구성합니다. distributionVersion 필드에 OpenShift Container Platform 버전을 지정합니다.

    참고: distributionVersion 의 값은 OpenShift Container Platform 릴리스 의 이미지와 일치합니다. 다음 YAML 리소스를 참조하십시오.

    apiVersion: controlplane.cluster.x-k8s.io/v1alpha2
    kind: OpenshiftAssistedControlPlane
    metadata:
      name: <cluster-name>
      namespace: <cluster-namespace>
      annotations: {}
    spec:
      openshiftAssistedConfigSpec:
        sshAuthorizedKey: "{{ ssh_authorized_key }}" 
    1
    
        nodeRegistration:
          kubeletExtraLabels:
          - 'metal3.io/uuid="${METADATA_UUID}"'
      distributionVersion: <4.x.0>
      config:
        apiVIPs:
        - 192.168.222.40
        ingressVIPs:
        - 192.168.222.41
        baseDomain: lab.home
        pullSecretRef:
          name: "pull-secret"
        sshAuthorizedKey: "{{ ssh_authorized_key }}" 
    2
    
      machineTemplate:
        infrastructureRef:
          apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
          kind: Metal3MachineTemplate
          name: <cluster-name-control-plane>
          namespace: <cluster-namespace>
      replicas: 3
    Copy to Clipboard Toggle word wrap

    <1>'.spec.openshiftAssistedConfigSpec.sshAuthorizedKey'는 부팅 (검색) 단계의 노드에 액세스하는 데 사용됩니다. <2>'.spec.config.sshAuthorizedKey'는 프로비저닝된 OpenShift Container Platform 노드에 액세스하는 데 사용됩니다.

  7. YAML 파일을 적용합니다. 다음 명령을 실행합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  8. 풀 시크릿이 없는 경우 클러스터에서 컨테이너 레지스트리에서 이미지를 가져올 수 있도록 풀 시크릿을 생성해야 합니다. 풀 시크릿을 생성하려면 다음 단계를 완료합니다.
  9. YAML 파일을 생성하여 이미지를 가져옵니다. pull-secret.yaml 이라는 파일의 다음 예제를 참조하십시오.

    apiVersion: v1
    kind: Secret
    metadata:
      name: pull-secret
      namespace: <cluster-namespace> 
    1
    
    data:
      .dockerconfigjson: <encoded_docker_configuration> 
    2
    
    type: kubernetes.io/dockerconfigjson
    Copy to Clipboard Toggle word wrap
    1 1
    네임스페이스 값이 대상 네임스페이스 와 일치하는지 확인합니다.
    2 2
    base64로 인코딩된 구성 파일을 값으로 지정합니다.
  10. 다음 명령을 실행하여 파일을 적용합니다.

    oc apply -f pull-secret.yaml
    Copy to Clipboard Toggle word wrap
  11. baremetal에 클러스터 배포와 관련된 정보가 포함된 Metal3Cluster 인프라 리소스를 구성합니다.

    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: Metal3Cluster
    metadata:
      name: <cluster-name>
      namespace: <cluster-namespace>
    spec:
      controlPlaneEndpoint:
        host: <cluster-name>.lab.home 
    1
    
        port: 6443
      noCloudProvider: true
    Copy to Clipboard Toggle word wrap
    1
    호스트 는 클러스터 리소스의 clusterName과 함께 < clusterName >.<baseDomain>* 값이고 baseDomainOpenshiftAssistedControlPlane 리소스에 정의됩니다.
  12. 파일을 적용합니다. 다음 명령을 실행합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  13. OpenshiftAssistedControlPlane 리소스에서 참조하는 컨트롤 플레인 노드에 대해 Metal3MachineTemplate 리소스를 구성합니다. 다음 YAML 샘플을 참조하십시오.

    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: Metal3MachineTemplate
    metadata:
      name: <cluster-name>
      namespace: <cluster-namespace>
    spec:
      nodeReuse: false
      template:
        spec:
          automatedCleaningMode: disabled
          dataTemplate:
            name: <cluster-name-template>
          image: 
    1
    
            checksum: https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.19/4.19.0/sha256sum.txt
            checksumType: sha256
            url: https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.19/4.19.0/rhcos-4.19.0-x86_64-nutanix.x86_64.qcow2
            format: qcow2
    ---
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: Metal3DataTemplate
    metadata:
       name: <cluster-name-template>
       namespace: <cluster-namespace>
    spec:
       clusterName: <cluster-name> 
    2
    Copy to Clipboard Toggle word wrap
    1
    이미지는 OpenShift Container Platform 릴리스distributionVersion 값과 버전과 일치합니다.
    2
    clusterNameCluster 리소스에 있는 값과 동일한 값으로 설정합니다.
  14. 파일을 적용합니다. 다음 명령을 실행합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  15. Metal3MachineTemplate 을 참조하는 MachineDeployment 리소스를 사용하여 작업자 노드를 구성합니다. 다음 YAML 예제를 참조하십시오.

    apiVersion: cluster.x-k8s.io/v1beta1
    kind: MachineDeployment
    metadata:
      name: <cluster-name-worker>
      namespace: <cluster-namespace>
      labels:
        cluster.x-k8s.io/cluster-name: <cluster-name>
    spec:
      clusterName: <cluster-name>
      replicas: 2
      selector:
        matchLabels:
          cluster.x-k8s.io/cluster-name: <cluster-name>
      template:
        metadata:
          labels:
            cluster.x-k8s.io/cluster-name: <cluster-name>
        spec:
          clusterName: <cluster-name>
          bootstrap: 
    1
    
            configRef:
              name: <cluster-name-worker>
              apiVersion: bootstrap.cluster.x-k8s.io/v1alpha1
              kind: OpenshiftAssistedConfigTemplate
          infrastructureRef: 
    2
    
            name: <cluster-name-workers-2>
            apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
            kind: Metal3MachineTemplate
    Copy to Clipboard Toggle word wrap
    1
    부트스트랩 구성은 설치를 위해 다음 리소스에서도 참조됩니다.
    2
    인프라 참조는 프로비저닝할 리소스를 가리킵니다.
  16. 파일을 적용합니다. 다음 명령을 실행합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  17. MachineDeployment 에서 참조되는 OpenshiftAssistedConfigTemplate 리소스를 생성합니다. 다음 YAML은 작업자 노드의 부트스트랩 구성을 정의하고 지원 설치 프로그램에 노드를 등록하는 데 사용됩니다.

    apiVersion: bootstrap.cluster.x-k8s.io/v1alpha1
    kind: OpenshiftAssistedConfigTemplate
    metadata:
      name: <cluster-name-worker>
      namespace: <cluster-namespace>
      labels:
        cluster.x-k8s.io/cluster-name: cluster-name
    spec:
      template:
        spec:
          nodeRegistration:
            kubeletExtraLabels:
              - 'metal3.io/uuid="${METADATA_UUID}"'
    1
    
          sshAuthorizedKey: "{{ ssh_authorized_key }}" 
    2
    Copy to Clipboard Toggle word wrap
    1
    kubeletExtraLabels 는 이 값에서 변경할 수 없습니다.
    2
    sshAuthorizedKey 를 입력합니다.
  18. MachineDeployment 리소스에서 참조되는 Metal3MachineTemplate 을 생성합니다. 다음 예제를 참조하십시오.

    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: Metal3MachineTemplate
    metadata:
       name: <cluster-name-workers-2>
       namespace: <cluster-namespace>
    spec:
       nodeReuse: false
       template:
          spec:
             automatedCleaningMode: metadata
             dataTemplate:
                name: <cluster-name-workers-template>
          image:
            checksum: https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.19/4.19.0/sha256sum.txt
            checksumType: sha256
            url: https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.19/4.19.0/rhcos-4.19.0-x86_64-nutanix.x86_64.qcow2
            format: qcow2
    ---
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: Metal3DataTemplate
    metadata:
       name: <cluster-name-workers-template>
       namespace: <cluster-namespace>
    spec:
       clusterName: <cluster-name>
    Copy to Clipboard Toggle word wrap
  19. 다음 명령을 실행하여 YAML 파일을 저장하고 클러스터를 프로비저닝합니다.

    oc apply -f <filename>.yaml
    Copy to Clipboard Toggle word wrap
  20. 클러스터 프로비저닝 상태를 확인합니다.

    1. oc get cluster --namespace <cluster-namespace> <cluster-name> -o yaml 을 실행하여 클러스터 리소스 상태를 확인합니다.

      다음 출력 및 상태를 참조하십시오.

      status:
        conditions:
        - lastTransitionTime: "2025-06-25T11:23:38Z"
          status: "True"
          type: Ready
        - lastTransitionTime: "2025-06-25T11:23:38Z"
          status: "True"
          type: ControlPlaneReady
        - lastTransitionTime: "2025-06-25T10:37:03Z"
          status: "True"
          type: InfrastructureReady
      Copy to Clipboard Toggle word wrap
    2. oc get metal3cluster --namespace <cluster-namespace> <cluster-name> -o yaml 명령을 실행하여 클러스터 인프라 상태를 확인합니다.

      다음 출력 및 상태를 참조하십시오.

      status:
        conditions:
        - lastTransitionTime: "2025-06-25T10:37:03Z"
          status: "True"
          type: Ready
        - lastTransitionTime: "2025-06-25T10:37:03Z"
          status: "True"
          type: BaremetalInfrastructureReady
      Copy to Clipboard Toggle word wrap
    3. oc get openshiftassistedcontrolplane --namespace <cluster-namespace> <cluster-name> -o yaml 명령을 실행하여 컨트롤 플레인 상태를 확인합니다.

      다음 출력 및 상태를 참조하십시오.

      status:
        conditions:
        - lastTransitionTime: "2025-06-25T11:23:38Z"
          status: "True"
          type: Ready
        - lastTransitionTime: "2025-06-25T11:23:38Z"
          status: "True"
          type: ControlPlaneReady
        - lastTransitionTime: "2025-06-25T10:45:48Z"
          status: "True"
          type: KubeconfigAvailable
        - lastTransitionTime: "2025-06-25T10:38:25Z"
          status: "True"
          type: MachinesCreated
        - lastTransitionTime: "2025-06-25T11:10:54Z"
          status: "True"
          type: MachinesReady
        - lastTransitionTime: "2025-06-25T11:23:38Z"
          status: "True"
          type: UpgradeCompleted
      Copy to Clipboard Toggle word wrap
    4. oc get machinedeployment --namespace <cluster-namespace> <cluster-name> -o yaml 명령을 실행하여 머신 배포 상태를 확인합니다.

      다음 출력 및 상태를 참조하십시오.

      status:
        conditions:
        - lastTransitionTime: "2025-06-25T11:10:29Z"
          status: "True"
          type: Ready
        - lastTransitionTime: "2025-06-25T11:10:29Z"
          status: "True"
          type: Available
        - lastTransitionTime: "2025-06-25T11:10:29Z"
          status: "True"
          type: MachineSetReady
      Copy to Clipboard Toggle word wrap
    5. kubectl get machine -l cluster.x-k8s.io/cluster-name=cluster-name -n test-capi -o yaml 명령을 실행하여 머신을 확인합니다.

      다음 출력 및 상태를 참조하십시오.

     status:
        conditions:
        - lastTransitionTime: "2025-06-25T11:09:57Z"
      	status: "True"
      	type: Ready
        - lastTransitionTime: "2025-06-25T10:38:20Z"
      	status: "True"
      	type: BootstrapReady
        - lastTransitionTime: "2025-06-25T11:09:57Z"
      	status: "True"
      	type: InfrastructureReady
        - lastTransitionTime: "2025-06-25T11:10:29Z"
      	status: "True"
      	type: NodeHealthy
    Copy to Clipboard Toggle word wrap
  21. 클러스터에 액세스합니다.

    1. 다음 명령을 실행하여 kubeconfig 파일을 가져옵니다.

      oc get secret -n test-capi  cluster-name-admin-kubeconfig -o json | jq -r .data.kubeconfig | base64 --decode > kubeconfig
      Copy to Clipboard Toggle word wrap
    2. 다음 명령을 실행하여 kubeconfig 파일을 사용하여 클러스터에 액세스합니다.
    export KUBECONFIG=$(realpath kubeconfig)
    oc get nodes
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat