7.2. 프로덕션 환경의 인프라 머신 세트 생성
프로덕션 배포에서는 인프라 구성 요소를 유지하기 위해 3개 이상의 머신 세트를 배포하는 것이 좋습니다. OpenShift Logging 및 Red Hat OpenShift Service Mesh는 모두 Elasticsearch를 배포합니다. 이 경우 서로 다른 노드에 3개의 인스턴스를 설치해야 합니다. 이러한 각 노드는 고가용성을 위해 다양한 가용 영역에 배포할 수 있습니다. 이와 같은 구성에는 가용성 영역마다 하나씩 세 개의 다른 시스템 집합이 필요합니다. 여러 가용성 영역이 없는 글로벌 Azure 리전에서는 가용성 세트를 사용하여 고가용성을 보장할 수 있습니다.
7.2.1. 다른 클라우드의 머신 세트 생성
클라우드에 샘플 머신 세트를 사용합니다.
7.2.1.1. AWS에서 머신 세트 사용자 지정 리소스의 샘플 YAML
이 샘플 YAML은 us-east-1a
AWS(Amazon Web Services) 영역에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/infra: ""
로 레이블이 지정된 노드를 생성합니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <infra>
는 추가할 노드 레이블입니다.
apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 1 name: <infrastructure_id>-infra-<zone> 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>-infra-<zone> 4 template: metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 5 machine.openshift.io/cluster-api-machine-role: <infra> 6 machine.openshift.io/cluster-api-machine-type: <infra> 7 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra-<zone> 8 spec: metadata: labels: node-role.kubernetes.io/infra: "" 9 taints: 10 - key: node-role.kubernetes.io/infra effect: NoSchedule providerSpec: value: ami: id: ami-046fe691f52a953f9 11 apiVersion: awsproviderconfig.openshift.io/v1beta1 blockDevices: - ebs: iops: 0 volumeSize: 120 volumeType: gp2 credentialsSecret: name: aws-cloud-credentials deviceIndex: 0 iamInstanceProfile: id: <infrastructure_id>-worker-profile 12 instanceType: m4.large kind: AWSMachineProviderConfig placement: availabilityZone: us-east-1a region: us-east-1 securityGroups: - filters: - name: tag:Name values: - <infrastructure_id>-worker-sg 13 subnet: filters: - name: tag:Name values: - <infrastructure_id>-private-us-east-1a 14 tags: - name: kubernetes.io/cluster/<infrastructure_id> 15 value: owned userDataSecret: name: worker-user-data
- 1 3 5 12 13 14 15
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
- 2 4 8
- 인프라 ID,
<infra>
노드 레이블 및 영역을 지정합니다. - 6 7 9
<infra>
노드 레이블을 지정합니다.- 10
- 사용자 워크로드가 인프라 노드에서 예약되지 않도록 테인트를 지정합니다.
- 11
- OpenShift Container Platform 노드의 AWS(Amazon Web Services) 영역에 유효한 RHCOS(Red Hat Enterprise Linux CoreOS) AMI를 지정합니다.
$ oc -n openshift-machine-api \ -o jsonpath='{.spec.template.spec.providerSpec.value.ami.id}{"\n"}' \ get machineset/<infrastructure_id>-worker-<zone>
AWS에서 실행되는 머신 세트는 보장되지 않는 Spot 인스턴스를 지원합니다. AWS의 온 디맨드 인스턴스에 비해 저렴한 가격으로 Spot 인스턴스를 사용하여 비용을 절약할 수 있습니다. spotMarketOptions
를 MachineSet
YAML 파일에 추가하여 Spot 인스턴스를 구성합니다.
7.2.1.2. Azure의 머신 세트사용자 지정 리소스에 대한 샘플 YAML
이 샘플 YAML은 리전의 1
Microsoft Azure 영역에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/infra: ""
로 레이블이 지정된 노드를 만듭니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <infra>
는 추가할 노드 레이블입니다.
apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 1 machine.openshift.io/cluster-api-machine-role: <infra> 2 machine.openshift.io/cluster-api-machine-type: <infra> 3 name: <infrastructure_id>-infra-<region> 4 namespace: openshift-machine-api spec: replicas: 1 selector: matchLabels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 5 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra-<region> 6 template: metadata: creationTimestamp: null labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 7 machine.openshift.io/cluster-api-machine-role: <infra> 8 machine.openshift.io/cluster-api-machine-type: <infra> 9 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra-<region> 10 spec: metadata: creationTimestamp: null labels: node-role.kubernetes.io/infra: "" 11 taints: 12 - key: node-role.kubernetes.io/infra effect: NoSchedule providerSpec: value: apiVersion: azureproviderconfig.openshift.io/v1beta1 credentialsSecret: name: azure-cloud-credentials namespace: openshift-machine-api image: offer: "" publisher: "" resourceID: /resourceGroups/<infrastructure_id>-rg/providers/Microsoft.Compute/images/<infrastructure_id> 13 sku: "" version: "" internalLoadBalancer: "" kind: AzureMachineProviderSpec location: <region> 14 managedIdentity: <infrastructure_id>-identity 15 metadata: creationTimestamp: null natRule: null networkResourceGroup: "" osDisk: diskSizeGB: 128 managedDisk: storageAccountType: Premium_LRS osType: Linux publicIP: false publicLoadBalancer: "" resourceGroup: <infrastructure_id>-rg 16 sshPrivateKey: "" sshPublicKey: "" subnet: <infrastructure_id>-<role>-subnet 17 18 userDataSecret: name: worker-user-data 19 vmSize: Standard_DS4_v2 vnet: <infrastructure_id>-vnet 20 zone: "1" 21
- 1 5 7 13 15 16 17 20
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
다음 명령을 실행하여 서브넷을 가져올 수 있습니다.
$ oc -n openshift-machine-api \ -o jsonpath='{.spec.template.spec.providerSpec.value.subnet}{"\n"}' \ get machineset/<infrastructure_id>-worker-centralus1
다음 명령을 실행하여 vnet을 가져올 수 있습니다.
$ oc -n openshift-machine-api \ -o jsonpath='{.spec.template.spec.providerSpec.value.vnet}{"\n"}' \ get machineset/<infrastructure_id>-worker-centralus1
- 2 3 8 9 11 18 19
<infra>
노드 레이블을 지정합니다.- 4 6 10
- 인프라 ID,
<infra>
노드 레이블 및 리전을 지정합니다. - 12
- 사용자 워크로드가 인프라 노드에서 예약되지 않도록 테인트를 지정합니다.
- 14
- 머신을 배치할 리전을 지정합니다.
- 21
- 머신을 배치할 리전 내 영역을 지정합니다. 해당 리전이 지정한 영역을 지원하는지 확인합니다.
Azure에서 실행되는 머신 세트는 보장되지 않는 Spot 가상 머신을 지원합니다. Azure의 표준 가상 머신에 비해 더 낮은 가격으로 Spot 가상 머신을 사용하여 비용을 절감할 수 있습니다. spotVMOptions
를 MachineSet
YAML 파일에 추가하여 Spot 가상 머신을 구성할 수 있습니다.
7.2.1.3. GCP에서 머신 세트 사용자 정의 리소스의 샘플 YAML
이 샘플 YAML은 GCP(Google Cloud Platform)에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/infra: ""
로 레이블이 지정된 노드를 생성합니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <infra>
는 추가할 노드 레이블입니다.
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: <infra> 6 machine.openshift.io/cluster-api-machine-type: <infra> 7 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-w-a 8 spec: metadata: labels: node-role.kubernetes.io/infra: "" 9 taints: 10 - key: node-role.kubernetes.io/infra effect: NoSchedule 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> 11 labels: null sizeGb: 128 type: pd-ssd gcpMetadata: 12 - key: <custom_metadata_key> value: <custom_metadata_value> kind: GCPMachineProviderSpec machineType: n1-standard-4 metadata: creationTimestamp: null networkInterfaces: - network: <infrastructure_id>-network 13 subnetwork: <infrastructure_id>-worker-subnet 14 projectID: <project_name> 15 region: us-central1 serviceAccounts: - email: <infrastructure_id>-w@<project_name>.iam.gserviceaccount.com 16 17 scopes: - https://www.googleapis.com/auth/cloud-platform tags: - <infrastructure_id>-worker 18 userDataSecret: name: worker-user-data zone: us-central1-a
- 1 2 3 4 5 8 13 14 16 18
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
- 6 7 9
<infra>
노드 레이블을 지정합니다.- 10
- 사용자 워크로드가 인프라 노드에서 예약되지 않도록 테인트를 지정합니다.
- 11
- 현재 머신 세트에서 사용되는 이미지의 경로를 지정합니다. OpenShift CLI가 설치되어 있으면 다음 명령을 실행하여 이미지에 대한 경로를 얻을 수 있습니다.
$ oc -n openshift-machine-api \ -o jsonpath='{.spec.template.spec.providerSpec.value.disks[0].image}{"\n"}' \ get machineset/<infrastructure_id>-worker-a
- 12
- 선택 사항:
키:값
쌍의 형식으로 사용자 정의 메타데이터를 지정합니다. 예를 들어 사용자 정의 메타데이터 설정에 대한 GCP 설명서를 참조하십시오. - 15 17
- 클러스터에 사용하는 GCP 프로젝트의 이름을 지정합니다.
GCP에서 실행되는 머신 세트는 보장되지 않은 선점 가능한 가상 머신 인스턴스를 지원합니다. GCP의 일반 인스턴스에 비해 더 낮은 가격으로 선점 가능한 가상 머신 인스턴스를 사용하여 비용을 절감할 수 있습니다. preemptible
을 MachineSet
YAML 파일에 추가하고 선점할 수 있는 가상 머신 인스턴스를 구성할 수 있습니다.
7.2.1.4. RHOSP에서 머신 세트 사용자 정의 리소스의 샘플 YAML
이 샘플 YAML은 RHOSP(Red Hat OpenStack Platform)에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/infra: ""
로 레이블이 지정된 노드를 생성합니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <infra>
는 추가할 노드 레이블입니다.
apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 1 machine.openshift.io/cluster-api-machine-role: <infra> 2 machine.openshift.io/cluster-api-machine-type: <infra> 3 name: <infrastructure_id>-infra 4 namespace: openshift-machine-api spec: replicas: <number_of_replicas> selector: matchLabels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 5 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra 6 template: metadata: labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 7 machine.openshift.io/cluster-api-machine-role: <infra> 8 machine.openshift.io/cluster-api-machine-type: <infra> 9 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra 10 spec: metadata: creationTimestamp: null labels: node-role.kubernetes.io/infra: "" taints: 11 - key: node-role.kubernetes.io/infra effect: NoSchedule providerSpec: value: apiVersion: openstackproviderconfig.openshift.io/v1alpha1 cloudName: openstack cloudsSecret: name: openstack-cloud-credentials namespace: openshift-machine-api flavor: <nova_flavor> image: <glance_image_name_or_location> serverGroupID: <optional_UUID_of_server_group> 12 kind: OpenstackProviderSpec networks: 13 - filter: {} subnets: - filter: name: <subnet_name> tags: openshiftClusterID=<infrastructure_id> 14 primarySubnet: <rhosp_subnet_UUID> 15 securityGroups: - filter: {} name: <infrastructure_id>-worker 16 serverMetadata: Name: <infrastructure_id>-worker 17 openshiftClusterID: <infrastructure_id> 18 tags: - openshiftClusterID=<infrastructure_id> 19 trunk: true userDataSecret: name: worker-user-data 20 availabilityZone: <optional_openstack_availability_zone>
- 1 5 7 14 16 17 18 19
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.
$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
- 2 3 8 9 20
<infra>
노드 레이블을 지정합니다.- 4 6 10
- 인프라 ID 및
<infra>
노드 레이블을 지정합니다. - 11
- 사용자 워크로드가 인프라 노드에서 예약되지 않도록 테인트를 지정합니다.
- 12
- MachineSet의 서버 그룹 정책을 설정하려면, 서버 그룹 생성에서 반환된 값을 입력합니다. 대부분의 배포에는
anti-affinity
또는soft-anti-affinity
정책이 권장됩니다. - 13
- 여러 네트워크에 배포해야 합니다. 여러 네트워크에 배포하는 경우 이 목록에는
primarySubnet
값으로 사용되는 네트워크를 포함해야 합니다. - 15
- 노드 엔드포인트를 게시할 RHOSP 서브넷을 지정합니다. 일반적으로 이 서브넷은
install-config.yaml
파일에서machineSubnet
값으로 사용되는 서브넷과 동일합니다.
7.2.1.5. vSphere에서 머신 세트 사용자 정의 리소스의 샘플 YAML
이 샘플 YAML은 VMware vSphere에서 실행되는 머신 세트를 정의하고 node-role.kubernetes.io/infra: ""
로 레이블이 지정된 노드를 만듭니다.
이 샘플에서 <infrastructure_id>
는 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID 레이블이며 <infra>
는 추가할 노드 레이블입니다.
apiVersion: machine.openshift.io/v1beta1 kind: MachineSet metadata: creationTimestamp: null labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 1 name: <infrastructure_id>-infra 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>-infra 4 template: metadata: creationTimestamp: null labels: machine.openshift.io/cluster-api-cluster: <infrastructure_id> 5 machine.openshift.io/cluster-api-machine-role: <infra> 6 machine.openshift.io/cluster-api-machine-type: <infra> 7 machine.openshift.io/cluster-api-machineset: <infrastructure_id>-infra 8 spec: metadata: creationTimestamp: null labels: node-role.kubernetes.io/infra: "" 9 taints: 10 - key: node-role.kubernetes.io/infra effect: NoSchedule providerSpec: value: apiVersion: vsphereprovider.openshift.io/v1beta1 credentialsSecret: name: vsphere-cloud-credentials diskGiB: 120 kind: VSphereMachineProviderSpec memoryMiB: 8192 metadata: creationTimestamp: null network: devices: - networkName: "<vm_network_name>" 11 numCPUs: 4 numCoresPerSocket: 1 snapshot: "" template: <vm_template_name> 12 userDataSecret: name: worker-user-data workspace: datacenter: <vcenter_datacenter_name> 13 datastore: <vcenter_datastore_name> 14 folder: <vcenter_vm_folder_path> 15 resourcepool: <vsphere_resource_pool> 16 server: <vcenter_server_ip> 17
- 1 3 5
- 클러스터를 프로비저닝할 때 설정한 클러스터 ID를 기반으로 하는 인프라 ID를 지정합니다. OpenShift CLI (
oc
) 패키지가 설치되어 있으면 다음 명령을 실행하여 인프라 ID를 얻을 수 있습니다.$ oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
- 2 4 8
- 인프라 ID 및
<infra>
노드 레이블을 지정합니다. - 6 7 9
<infra>
노드 레이블을 지정합니다.- 10
- 사용자 워크로드가 인프라 노드에서 예약되지 않도록 테인트를 지정합니다.
- 11
- 머신 세트를 배포할 vSphere VM 네트워크를 지정합니다.
- 12
- 사용할 vSphere VM 템플릿 (예:
user-5ddjd-rhcos)
을 지정합니다. - 13
- 머신 세트를 배포할 vCenter Datacenter를 지정합니다.
- 14
- 머신 세트를 배포할 vCenter Datastore를 지정합니다.
- 15
- vCenter의 vSphere VM 폴더에 경로(예:
/dc1/vm/user-inst-5ddjd
)를 지정합니다. - 16
- VM의 vSphere 리소스 풀을 지정합니다.
- 17
- vCenter 서버 IP 또는 정규화된 도메인 이름을 지정합니다.