4.11.14. AWS에서 작업자 노드 생성
클러스터가 사용할 작업자 노드를 AWS(Amazon Web Services)에서 생성할 수 있습니다.
제공된 CloudFormation 템플릿과 사용자 정의 매개변수 파일을 사용하여 작업자 노드를 나타내는 AWS 리소스 스택을 생성할 수 있습니다.
CloudFormation 템플릿은 하나의 작업자 노드를 나타내는 스택을 생성합니다. 각 작업자 노드의 스택을 생성해야 합니다.
작업자 노드를 생성하는 데 제공된 CloudFormation 템플릿을 사용하지 않는 경우, 제공된 정보를 검토하고 수동으로 인프라를 생성해야 합니다.. 클러스터가 올바르게 초기화되지 않은 경우, Red Hat 지원팀에 설치 로그를 제시하여 문의해야 할 수도 있습니다.
사전 요구 사항
- AWS 계정을 구성했습니다.
-
aws 구성
을 실행하여 AWS 키와 리전을 로컬 AWS 프로필에 추가하셨습니다. - 클러스터에 대한 Ignition 구성 파일을 생성하셨습니다.
- AWS에서 VPC 및 관련 서브넷을 생성하고 구성하셨습니다.
- AWS에서 DNS, 로드 밸런서 및 리스너를 생성하고 구성하셨습니다.
- AWS에서 클러스터에 필요한 보안 그룹 및 역할을 생성하셨습니다.
- 부트스트랩 시스템을 생성하셨습니다.
- 컨트롤 플레인 시스템을 생성하셨습니다.
프로세스
CloudFormation 템플릿에 필요한 매개변수 값이 포함된 JSON 파일을 만듭니다.
[ { "ParameterKey": "InfrastructureName", 1 "ParameterValue": "mycluster-<random_string>" 2 }, { "ParameterKey": "RhcosAmi", 3 "ParameterValue": "ami-<random_string>" 4 }, { "ParameterKey": "Subnet", 5 "ParameterValue": "subnet-<random_string>" 6 }, { "ParameterKey": "WorkerSecurityGroupId", 7 "ParameterValue": "sg-<random_string>" 8 }, { "ParameterKey": "IgnitionLocation", 9 "ParameterValue": "https://api-int.<cluster_name>.<domain_name>:22623/config/worker" 10 }, { "ParameterKey": "CertificateAuthorities", 11 "ParameterValue": "" 12 }, { "ParameterKey": "WorkerInstanceProfileName", 13 "ParameterValue": "" 14 }, { "ParameterKey": "WorkerInstanceType", 15 "ParameterValue": "m4.2xlarge" 16 } ]
- 1
- 클러스터에 대해 Ignition 구성 파일에 인코딩되는 클러스터 인프라의 이름입니다.
- 2
- Ignition 구성 파일 메타데이터에서 추출한 인프라 이름을
<cluster-name>-<random-string>
형식으로 지정합니다. - 3
- 작업자 노드에 사용할 현재 RHCOS(Red Hat Enterprise Linux CoreOS) AMI입니다.
- 4
- 유효한
AWS::EC2::Image::Id
값을 지정합니다. - 5
- 작업자 노드를 시작하기 위한 서브넷(프라이빗)입니다.
- 6
- DNS 및 로드 밸런싱을 위해 CloudFormation 템플릿의 출력에서
PrivateSubnets
값의 서브넷을 지정합니다. - 7
- 작업자 노드와 연결할 작업자 보안 그룹 ID입니다.
- 8
- 보안 그룹 및 역할에 대한 CloudFormation 템플릿 출력에서
WorkerSecurityGroupId
값을 지정합니다. - 9
- 부트스트랩 Ignition 구성 파일을 가져올 위치입니다.
- 10
- 생성된 Ignition 구성 위치(
https://api-int.<cluster_name>.<domain_name>:22623/config/worker
)를 지정합니다. - 11
- 사용할 base64로 인코딩 인증 기관 문자열입니다.
- 12
- 설치 디렉터리에 있는
worker.ign
파일에서 값을 지정합니다. 이 값은data:text/plain;charset=utf-8;base64,ABC… 형식의 긴 문자열입니다.xYz==
. - 13
- 작업자 노드와 연결할 IAM 프로필입니다.
- 14
- 보안 그룹 및 역할에 대한 CloudFormation 템플릿 출력에서
WorkerInstanceProfile
매개변수 값을 지정합니다. - 15
- 컨트롤 플레인 시스템에 사용할 AWS 인스턴스 유형입니다.
- 16
- 허용되는 값:
-
m4.large
-
m4.xlarge
-
m4.2xlarge
-
m4.4xlarge
-
m4.10xlarge
-
m4.16xlarge
-
m5.large
-
m5.xlarge
-
m5.2xlarge
-
m5.4xlarge
-
m5.8xlarge
-
m5.12xlarge
-
m5.16xlarge
-
m5a.large
-
m5a.xlarge
-
m5a.2xlarge
-
m5a.4xlarge
-
m5a.8xlarge
-
m5a.10xlarge
-
m5a.16xlarge
-
c4.large
-
c4.xlarge
-
c4.2xlarge
-
c4.4xlarge
-
c4.8xlarge
-
c5.large
-
c5.xlarge
-
c5.2xlarge
-
c5.4xlarge
-
c5.9xlarge
-
c5.12xlarge
-
c5.18xlarge
-
c5.24xlarge
-
c5a.large
-
c5a.xlarge
-
c5a.2xlarge
-
c5a.4xlarge
-
c5a.8xlarge
-
c5a.12xlarge
-
c5a.16xlarge
-
c5a.24xlarge
-
r4.large
-
r4.xlarge
-
r4.2xlarge
-
r4.4xlarge
-
r4.8xlarge
-
r4.16xlarge
-
r5.large
-
r5.xlarge
-
r5.2xlarge
-
r5.4xlarge
-
r5.8xlarge
-
r5.12xlarge
-
r5.16xlarge
-
r5.24xlarge
-
r5a.large
-
r5a.xlarge
-
r5a.2xlarge
-
r5a.4xlarge
-
r5a.8xlarge
-
r5a.12xlarge
-
r5a.16xlarge
-
r5a.24xlarge
-
t3.large
-
t3.xlarge
-
t3.2xlarge
-
t3a.large
-
t3a.xlarge
-
t3a.2xlarge
-
- 이 항목의 작업자 시스템에 대한 CloudFormation 템플릿 섹션에서 템플릿을 복사하여 사용자 시스템에 YAML 파일로 저장합니다. 이 템플릿은 클러스터에 필요한 네트워킹 개체 및 로드 밸런서를 설명합니다.
-
WorkerInstanceType
값으로M5
인스턴스 유형을 지정한 경우 CloudFormation 템플릿의WorkerInstanceType.AllowedValues
매개변수에 해당 인스턴스 유형을 추가합니다. CloudFormation 템플릿을 시작하여 작업자 노드를 나타내는 AWS 리소스 스택을 생성합니다.
중요명령은 한 줄로 입력해야 합니다.
$ aws cloudformation create-stack --stack-name <name> 1 --template-body file://<template>.yaml \ 2 --parameters file://<parameters>.json 3
출력 예
arn:aws:cloudformation:us-east-1:269333783861:stack/cluster-worker-1/729ee301-1c2a-11eb-348f-sd9888c65b59
참고CloudFormation 템플릿은 하나의 작업자 노드를 나타내는 스택을 생성합니다.
템플릿 구성 요소가 있는지 확인합니다.
$ aws cloudformation describe-stacks --stack-name <name>
클러스터에 충분한 작업자 시스템을 생성할 때까지 계속해서 작업자 스택을 생성합니다. 동일한 템플릿 및 매개변수 파일을 참조하고 다른 스택 이름을 지정하여 추가 작업자 스택을 생성할 수 있습니다.
중요작업자 시스템을 두 개 이상 생성해야 하므로 이 CloudFormation 템플릿을 사용하는 스택을 두 개 이상 생성해야 합니다.
4.11.14.1. 작업자 시스템용 CloudFormation 템플릿
다음 CloudFormation 템플릿을 사용하여 OpenShift Container Platform 클러스터에 필요한 작업자 시스템을 배포할 수 있습니다.
예 4.40. 작업자 시스템용 CloudFormation 템플릿
AWSTemplateFormatVersion: 2010-09-09 Description: Template for OpenShift Cluster Node Launch (EC2 worker instance) Parameters: InfrastructureName: AllowedPattern: ^([a-zA-Z][a-zA-Z0-9\-]{0,26})$ MaxLength: 27 MinLength: 1 ConstraintDescription: Infrastructure name must be alphanumeric, start with a letter, and have a maximum of 27 characters. Description: A short, unique cluster ID used to tag nodes for the kubelet cloud provider. Type: String RhcosAmi: Description: Current Red Hat Enterprise Linux CoreOS AMI to use for bootstrap. Type: AWS::EC2::Image::Id Subnet: Description: The subnets, recommend private, to launch the master nodes into. Type: AWS::EC2::Subnet::Id WorkerSecurityGroupId: Description: The master security group ID to associate with master nodes. Type: AWS::EC2::SecurityGroup::Id IgnitionLocation: Default: https://api-int.$CLUSTER_NAME.$DOMAIN:22623/config/worker Description: Ignition config file location. Type: String CertificateAuthorities: Default: data:text/plain;charset=utf-8;base64,ABC...xYz== Description: Base64 encoded certificate authority string to use. Type: String WorkerInstanceProfileName: Description: IAM profile to associate with master nodes. Type: String WorkerInstanceType: Default: m5.large Type: String AllowedValues: - "m4.large" - "m4.xlarge" - "m4.2xlarge" - "m4.4xlarge" - "m4.10xlarge" - "m4.16xlarge" - "m5.large" - "m5.xlarge" - "m5.2xlarge" - "m5.4xlarge" - "m5.8xlarge" - "m5.12xlarge" - "m5.16xlarge" - "m5a.large" - "m5a.xlarge" - "m5a.2xlarge" - "m5a.4xlarge" - "m5a.8xlarge" - "m5a.10xlarge" - "m5a.16xlarge" - "c4.large" - "c4.xlarge" - "c4.2xlarge" - "c4.4xlarge" - "c4.8xlarge" - "c5.large" - "c5.xlarge" - "c5.2xlarge" - "c5.4xlarge" - "c5.9xlarge" - "c5.12xlarge" - "c5.18xlarge" - "c5.24xlarge" - "c5a.large" - "c5a.xlarge" - "c5a.2xlarge" - "c5a.4xlarge" - "c5a.8xlarge" - "c5a.12xlarge" - "c5a.16xlarge" - "c5a.24xlarge" - "r4.large" - "r4.xlarge" - "r4.2xlarge" - "r4.4xlarge" - "r4.8xlarge" - "r4.16xlarge" - "r5.large" - "r5.xlarge" - "r5.2xlarge" - "r5.4xlarge" - "r5.8xlarge" - "r5.12xlarge" - "r5.16xlarge" - "r5.24xlarge" - "r5a.large" - "r5a.xlarge" - "r5a.2xlarge" - "r5a.4xlarge" - "r5a.8xlarge" - "r5a.12xlarge" - "r5a.16xlarge" - "r5a.24xlarge" - "t3.large" - "t3.xlarge" - "t3.2xlarge" - "t3a.large" - "t3a.xlarge" - "t3a.2xlarge" Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: "Cluster Information" Parameters: - InfrastructureName - Label: default: "Host Information" Parameters: - WorkerInstanceType - RhcosAmi - IgnitionLocation - CertificateAuthorities - WorkerSecurityGroupId - WorkerInstanceProfileName - Label: default: "Network Configuration" Parameters: - Subnet ParameterLabels: Subnet: default: "Subnet" InfrastructureName: default: "Infrastructure Name" WorkerInstanceType: default: "Worker Instance Type" WorkerInstanceProfileName: default: "Worker Instance Profile Name" RhcosAmi: default: "Red Hat Enterprise Linux CoreOS AMI ID" IgnitionLocation: default: "Worker Ignition Source" CertificateAuthorities: default: "Ignition CA String" WorkerSecurityGroupId: default: "Worker Security Group ID" Resources: Worker0: Type: AWS::EC2::Instance Properties: ImageId: !Ref RhcosAmi BlockDeviceMappings: - DeviceName: /dev/xvda Ebs: VolumeSize: "120" VolumeType: "gp2" IamInstanceProfile: !Ref WorkerInstanceProfileName InstanceType: !Ref WorkerInstanceType NetworkInterfaces: - AssociatePublicIpAddress: "false" DeviceIndex: "0" GroupSet: - !Ref "WorkerSecurityGroupId" SubnetId: !Ref "Subnet" UserData: Fn::Base64: !Sub - '{"ignition":{"config":{"merge":[{"source":"${SOURCE}"}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}"}]}},"version":"3.1.0"}}' - { SOURCE: !Ref IgnitionLocation, CA_BUNDLE: !Ref CertificateAuthorities, } Tags: - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]] Value: "shared" Outputs: PrivateIP: Description: The compute node private IP address. Value: !GetAtt Worker0.PrivateIp
추가 리소스
- AWS CloudFormation 콘솔로 이동하여 생성하는 CloudFormation 스택에 대한 세부 정보를 볼 수 있습니다.