2.3.2. GCP에서 머신 세트 사용자 정의 리소스의 샘플 YAML
이 샘플 YAML은 Google Cloud Platform (GCP)에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/<role>: ""
로 레이블이 지정된 노드를 만듭니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <role>
은 추가할 노드 레이블입니다.
apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 1 name: <infrastructure_id>-w-a 2 namespace: openshift-machine-api spec: replicas: 1 selector: matchLabels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 3 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-w-a 4 template: metadata: creationTimestamp: null labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 5 machine.openshift.io/cluster-api-machine-role: <role> 6 machine.openshift.io/cluster-api-machine-type: <role> 7 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-w-a 8 spec: metadata: labels: node-role.kubernetes.io/<role>: "" 9 providerSpec: value: apiVersion: gcpprovider.openshift.io/v1beta1 canIPForward: false credentialsSecret: name: gcp-cloud-credentials deletionProtection: false disks: - autoDelete: true boot: true image: <path_to_image> 10 labels: null sizeGb: 128 type: pd-ssd gcpMetadata: 11 - key: <custom_metadata_key> value: <custom_metadata_value> kind: GCPMachineProviderSpec machineType: n1-standard-4 metadata: creationTimestamp: null networkInterfaces: - network: <infrastructure_id>-network 12 subnetwork: <infrastructure_id>-worker-subnet 13 projectID: <project_name> 14 region: us-central1 serviceAccounts: - email: <infrastructure_id>-w@<project_name>.iam.gserviceaccount.com 15 16 scopes: - https://www.googleapis.com/auth/cloud-platform tags: - <infrastructure_id>-worker 17 userDataSecret: name: worker-user-data zone: us-central1-a
- 1 2 3 4 5 8 12 13 15 17
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
- 6 7 9
- 추가할 노드 레이블을 지정합니다.
- 10
- 현재 머신 세트에서 사용되는 이미지의 경로를 지정합니다. OpenShift CLI가 설치되어 있으면 다음 명령을 실행하여 이미지에 대한 경로를 얻을 수 있습니다.
$ oc -n openshift-machine-api \ -o jsonpath='{.spec.template.spec.providerSpec.value.disks[0].image}{"\n"}' \ get machineset/<infrastructure_id>-worker-a
- 11
- 선택 사항:
키:값
쌍의 형식으로 사용자 정의 메타데이터를 지정합니다. 예를 들어 사용자 정의 메타데이터 설정에 대한 GCP 설명서를 참조하십시오. - 14 16
- 클러스터에 사용하는 GCP 프로젝트의 이름을 지정합니다.