This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.1.9.14. AWS でのワーカーノードの作成
クラスターで使用するワーカーノードを Amazon Web Services (AWS) で作成できます。
提供される CloudFormation テンプレートおよびカスタムパラメーターファイルを使用して、ワーカーノードを表す AWS リソースのスタックを作成できます。
CloudFormation テンプレートは、1 つのワーカーノードを表すスタックを作成します。それぞれのワーカーノードにスタックを作成する必要があります。
提供される CloudFormation テンプレートを使用してワーカーノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。
前提条件
- AWS アカウントを設定している。
-
aws configure
を実行して、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.large" 16 } ]
- 1
- クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
- 2
- 形式が
<cluster-name>-<random-string>
の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。 - 3
- ワーカーノードに使用する最新の Red Hat Enterprise Linux CoreOS(RHCOS)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 テンプレートの出力から
WokerInstanceProfile
パラメーターの値を指定します。 - 15
- コントロールプレーンマシンに使用する AWS インスタンスのタイプ。
- 16
- 許可される値:
-
m4.large
-
m4.xlarge
-
m4.2xlarge
-
m4.4xlarge
-
m4.8xlarge
-
m4.10xlarge
-
m4.16xlarge
-
m5.large
-
m5.xlarge
-
m5.2xlarge
-
m5.4xlarge
-
m5.8xlarge
-
m5.10xlarge
-
m5.16xlarge
-
m6i.xlarge
-
c4.2xlarge
-
c4.4xlarge
-
c4.8xlarge
-
r4.large
-
r4.xlarge
-
r4.2xlarge
-
r4.4xlarge
-
r4.8xlarge
r4.16xlarge
重要m4
インスタンスがeu-west-3
などのリージョンで利用可能ではない場合、m5
タイプを代わりに使用します。
-
- このトピックのワーカーマシンの CloudFormation テンプレートセクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なネットワークオブジェクトおよびロードバランサーについて記述しています。
-
m5
インスタンスタイプをWorkerInstanceType
の値として指定している場合、そのインスタンスタイプを 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 テンプレートは、1 つのワーカーノードを表すスタックを作成します。
テンプレートのコンポーネントが存在することを確認します。
$ aws cloudformation describe-stacks --stack-name <name>
クラスターに作成するワーカーマシンが十分な数に達するまでワーカースタックの作成を継続します。同じテンプレートおよびパラメーターファイルを参照し、異なるスタック名を指定してワーカースタックをさらに作成することができます。
重要2 つ以上のワーカーマシンを作成する必要があるため、この CloudFormation テンプレートを使用する 2 つ以上のスタックを作成する必要があります。
1.9.14.1. ワーカーマシンの CloudFormation テンプレート
以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なワーカーマシンをデプロイすることができます。
例1.30 ワーカーマシンの 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 スタックについての詳細を表示できます。