11.2. 샘플 YAML 파일

Cluster API Technology Preview의 경우 Cluster API에 필요한 기본 리소스를 수동으로 생성해야 합니다. 이 섹션의 YAML 파일 예제에서는 이러한 리소스가 함께 작동하도록 하고 사용자 환경에 적합한 머신의 설정을 구성하는 방법을 보여줍니다.

11.2.1. 클러스터 API 클러스터 리소스의 샘플 YAML

클러스터 리소스는 클러스터의 이름 및 인프라 공급자를 정의하고 Cluster API에서 관리합니다. 이 리소스는 모든 공급자에 대해 동일한 구조를 갖습니다.

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <cluster_name> 1
  namespace: openshift-cluster-api
spec:
  infrastructureRef:
    apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    kind: <infrastructure_kind> 2
    name: <cluster_name> 3
    namespace: openshift-cluster-api
1 3
클러스터 이름을 지정합니다.
2
클러스터의 인프라 유형을 지정합니다. 유효한 값은 다음과 같습니다.
  • AWSCluster: 클러스터가 AWS(Amazon Web Services)에서 실행되고 있습니다.
  • GCP( Google Cloud Platform)에서 클러스터가 실행 중입니다.

나머지 클러스터 API 리소스는 공급자별로 다릅니다. 클러스터의 YAML 파일 예를 참조하십시오.

11.2.2. Amazon Web Services 클러스터 구성을 위한 샘플 YAML 파일

일부 클러스터 API 리소스는 공급자별로 다릅니다. 이 섹션의 YAML 파일의 예제에서는 AWS(Amazon Web Services) 클러스터의 구성을 보여줍니다.

11.2.2.1. Amazon Web Services에서 클러스터 API 인프라 리소스의 샘플 YAML

인프라 리소스는 공급자별이며, 지역 및 서브넷과 같이 클러스터의 모든 머신 세트에서 공유하는 속성을 정의합니다. 머신 세트는 머신을 생성할 때 이 리소스를 참조합니다.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AWSCluster 1
metadata:
  name: <cluster_name> 2
  namespace: openshift-cluster-api
spec:
  region: <region> 3
1
클러스터의 인프라 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.
2
클러스터 이름을 지정합니다.
3
AWS 리전을 지정합니다.

11.2.2.2. Amazon Web Services에서 클러스터 API 머신 템플릿 리소스의 샘플 YAML

머신 템플릿 리소스는 공급자별이며 머신 세트가 생성하는 머신의 기본 속성을 정의합니다. 머신 세트는 머신을 생성할 때 이 템플릿을 참조합니다.

apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
kind: AWSMachineTemplate 1
metadata:
  name: <template_name> 2
  namespace: openshift-cluster-api
spec:
  template:
    spec: 3
      uncompressedUserData: true
      iamInstanceProfile: ....
      instanceType: m5.large
      cloudInit:
        insecureSkipSecretsManager: true
      ami:
        id: ....
      subnet:
        filters:
        - name: tag:Name
          values:
          - ...
      additionalSecurityGroups:
      - filters:
        - name: tag:Name
          values:
          - ...
1
머신 템플릿 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.
2
머신 템플릿의 이름을 지정합니다.
3
환경에 대한 세부 정보를 지정합니다. 여기에 있는 값은 예입니다.

11.2.2.3. Amazon Web Services에서 클러스터 API 머신 세트 리소스의 샘플 YAML

머신 세트 리소스는 생성하는 시스템의 추가 속성을 정의합니다. 머신 세트는 머신을 생성할 때 인프라 리소스 및 머신 템플릿도 참조합니다.

apiVersion: cluster.x-k8s.io/v1alpha4
kind: MachineSet
metadata:
  name: <machine_set_name> 1
  namespace: openshift-cluster-api
spec:
  clusterName: <cluster_name> 2
  replicas: 1
  selector:
    matchLabels:
      test: example
  template:
    metadata:
      labels:
        test: example
    spec:
      bootstrap:
         dataSecretName: worker-user-data 3
      clusterName: <cluster_name> 4
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
        kind: AWSMachineTemplate 5
        name: <cluster_name> 6
1
머신 세트의 이름을 지정합니다.
2 4 6
클러스터 이름을 지정합니다.
3
Cluster API Technology Preview의 경우 Operator는 openshift-machine-api 네임스페이스의 작업자 사용자 데이터 시크릿을 사용할 수 있습니다.
5
머신 템플릿 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.

11.2.3. Google Cloud Platform 클러스터 구성을 위한 샘플 YAML 파일

일부 클러스터 API 리소스는 공급자별로 다릅니다. 이 섹션의 YAML 파일의 예제에서는 GCP(Google Cloud Platform) 클러스터의 구성을 보여줍니다.

11.2.3.1. Google Cloud Platform에서 클러스터 API 인프라 리소스의 샘플 YAML

인프라 리소스는 공급자별이며, 지역 및 서브넷과 같이 클러스터의 모든 머신 세트에서 공유하는 속성을 정의합니다. 머신 세트는 머신을 생성할 때 이 리소스를 참조합니다.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPCluster 1
metadata:
  name: <cluster_name> 2
spec:
  network:
    name: <cluster_name>-network 3
  project: <project> 4
  region: <region> 5
1
클러스터의 인프라 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.
2 3
클러스터 이름을 지정합니다.
4
GCP 프로젝트 이름을 지정합니다.
5
GCP 리전을 지정합니다.

11.2.3.2. Google Cloud Platform에서 클러스터 API 머신 템플릿 리소스의 샘플 YAML

머신 템플릿 리소스는 공급자별이며 머신 세트가 생성하는 머신의 기본 속성을 정의합니다. 머신 세트는 머신을 생성할 때 이 템플릿을 참조합니다.

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: GCPMachineTemplate 1
metadata:
  name: <template_name> 2
  namespace: openshift-cluster-api
spec:
  template:
    spec: 3
      rootDeviceType: pd-ssd
      rootDeviceSize: 128
      instanceType: n1-standard-4
      image: projects/rhcos-cloud/global/images/rhcos-411-85-202203181601-0-gcp-x86-64
      subnet: <cluster_name>-worker-subnet
      serviceAccounts:
        email: <service_account_email_address>
        scopes:
          - https://www.googleapis.com/auth/cloud-platform
      additionalLabels:
        kubernetes-io-cluster-<cluster_name>: owned
      additionalNetworkTags:
        - <cluster_name>-worker
      ipForwarding: Disabled
1
머신 템플릿 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.
2
머신 템플릿의 이름을 지정합니다.
3
환경에 대한 세부 정보를 지정합니다. 여기에 있는 값은 예입니다.

11.2.3.3. Google Cloud Platform에서 클러스터 API 머신 세트 리소스의 샘플 YAML

머신 세트 리소스는 생성하는 시스템의 추가 속성을 정의합니다. 머신 세트는 머신을 생성할 때 인프라 리소스 및 머신 템플릿도 참조합니다.

apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineSet
metadata:
  name: <machine_set_name> 1
  namespace: openshift-cluster-api
spec:
  clusterName: <cluster_name> 2
  replicas: 1
  selector:
    matchLabels:
      test: test
  template:
    metadata:
      labels:
        test: test
    spec:
      bootstrap:
         dataSecretName: worker-user-data 3
      clusterName: <cluster_name> 4
      infrastructureRef:
        apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
        kind: GCPMachineTemplate 5
        name: <machine_set_name> 6
      failureDomain: <failure_domain> 7
1 6
머신 세트의 이름을 지정합니다.
2 4
클러스터 이름을 지정합니다.
3
Cluster API Technology Preview의 경우 Operator는 openshift-machine-api 네임스페이스의 작업자 사용자 데이터 시크릿을 사용할 수 있습니다.
5
머신 템플릿 유형을 지정합니다. 이 값은 플랫폼 값과 일치해야 합니다.
7
GCP 리전 내에서 실패 도메인을 지정합니다.