AWS へのインストール

OpenShift Container Platform 4.2

OpenShift Container Platform 4.2 AWS クラスターのインストール

Red Hat OpenShift Documentation Team

概要

本書では、AWS に OpenShift Container Platform 4.2 クラスターをインストールし、アンインストールする方法について説明します。

第1章 AWS へのインストール

1.1. AWS アカウントの設定

OpenShift Container Platform をインストールする前に、Amazon Web Services (AWS) アカウントを設定する必要があります。

1.1.1. Route53 の設定

OpenShift Container Platform をインストールするには、使用する Amazon Web Services (AWS) アカウントに、Route53 サービスの専用のパブリックホストゾーンが必要になります。このゾーンはドメインに対する権威を持っている必要があります。 Route53 サービスは、クラスターへの外部接続のためのクラスターの DNS 解決および名前検索を提供します。

手順

  1. ドメイン、またはサブドメイン、およびレジストラーを特定します。既存のドメインおよびレジストラーを移行するか、または AWS または他のソースから新規のものを取得できます。

    注記

    AWS で新規ドメインを購入する場合、関連する DNS の変更が伝播するのに時間がかかります。AWS 経由でドメインを購入する方法についての詳細は、AWS ドキュメントの「 Registering Domain Names Using Amazon Route 53 」を参照してください。

  2. 既存のドメインおよびレジストラーを使用している場合、その DNS を AWS に移行します。AWS ドキュメントの「Making Amazon Route 53 the DNS Service for an Existing Domain」を参照してください。
  3. ドメインまたはサブドメインのパブリックホストゾーンを作成します。AWS ドキュメントの「Creating a Public Hosted Zone」を参照してください。

    openshiftcorp.com などのルートドメインや、 clusters.openshiftcorp.com などのサブドメインを使用します。

  4. ホストゾーンレコードから新規の権威ネームサーバーを抽出します。AWS ドキュメントの「Getting the Name Servers for a Public Hosted Zone」を参照してください。
  5. ドメインが使用する AWS Route53 ネームサーバーのレジストラーレコードを更新します。たとえば、別のアカウントを使ってドメインを Route53 サービスに登録している場合は、AWS ドキュメントの「Adding or Changing Name Servers or Glue Records」のトピックを参照してください。
  6. サブドメインを使用する場合は、所属する会社の手順に従ってその委任レコードを親ドメインに追加します。

1.1.2. AWS アカウントの制限

OpenShift Container Platform クラスターは数多くの Amazon Web Services (AWS) コンポーネントを使用し、デフォルトのサービス制限は、OpenShift Container Platform クラスターをインストールする機能に影響を与えます。特定のクラスター設定を使用し、クラスターを特定の AWS リージョンにデプロイするか、またはアカウントを使って複数のクラスターを実行する場合、AWS アカウントの追加リソースを要求することが必要になる場合があります。

以下の表は、OpenShift Container Platform クラスターのインストールおよび実行機能に影響を与える可能性のある AWS コンポーネントの制限を要約しています。

コンポーネントデフォルトで利用できるクラスターの数デフォルトの AWS の制限説明

インスタンスの制限

変動あり。

変動あり。

デフォルトで、各クラスターは以下のインスタンスを作成します。

  • 1 つのブートストラップマシン。これはインストール後に削除されます。
  • 3 つのマスターノード
  • 3 つのワーカーノード

これらのインスタンスタイプの数は、新規アカウントのデフォルト制限内の値です。追加のワーカーノードをデプロイし、自動スケーリングを有効にし、大規模なワークロードをデプロイするか、または異なるインスタンスタイプを使用するには、アカウントの制限を見直し、クラスターが必要なマシンをデプロイできることを確認します。

ほとんどのリージョンでは、ブートストラップおよびワーカーマシンは m4.large マシンを使用し、マスターマシンは m4.xlarge インスタンスを使用します。これらのインスタンスタイプをサポートしないすべてのリージョンを含む一部のリージョンでは、m5.large および m5.xlarge インスタンスが代わりに使用されます。

Elastic IP (EIP)

0 - 1

アカウントごとに 5 つの EIP

クラスターを高可用性設定でプロビジョニングするために、インストールプログラムはそれぞれのリージョン内のアベイラビリティーゾーンにパブリックおよびプライベートのサブネットを作成します。各プライベートサブネットには NAT ゲートウェイが必要であり、各 NAT ゲートウェイには別個の Elastic IP が必要です。AWS リージョンマップを確認して、各リージョンにあるアベイラビリティーゾーンの数を判別します。デフォルトの高可用性を利用するには、少なくとも 3 つのアベイラビリティーゾーンがあるリージョンにクラスターをインストールします。アベイラビリティーゾーンが 6 つ以上あるリージョンにクラスターをインストールするには、EIP 制限を引き上げる必要があります。

重要

us-east-1 リージョンを使用するには、アカウントの EIP 制限を引き上げる必要があります。

Virtual Private Cloud (VPC)

5

リージョンごとに 5 つの VPC

各クラスターは独自の VPC を作成します。

Elastic Load Balancing (ELB/NLB)

3

リージョンごとに 20

デフォルトで、各クラスターは、マスター API サーバーの内部および外部のネットワークロードバランサーおよびルーターの単一の Classic Elastic Load Balancer を作成します。追加の Kubernetes LoadBalancer Service オブジェクトをデプロイすると、追加のロードバランサーが作成されます。

NAT ゲートウェイ

5

アベイラビリティゾーンごとに 5 つ

クラスターは各アベイラビリティーゾーンに 1 つの NAT ゲートウェイをデプロイします。

Elastic Network Interface (ENI)

12 以上

リージョンごとに 350

デフォルトのインストールは 21 の ENI を作成し、リージョンの各アベイラビリティーゾーンに 1 つの ENI を作成します。たとえば、us-east-1 リージョンには 6 つのアベイラビリティーゾーンが含まれるため、そのゾーンにデプロイされるクラスターは 27 の ENI を使用します。AWS リージョンマップを確認して、各リージョンにあるアベイラビリティーゾーンの数を判別します。

追加の ENI が、クラスターの使用およびデプロイされたワークロード別に作成される追加のマシンおよび Elastic Load Balancer について作成されます。

VPC ゲートウェイ

20

アカウントごとに 20

各クラスターは、S3 アクセス用の単一の VPC ゲートウェイを作成します。

S3 バケット

99

アカウントごとに 100 バケット

インストールプロセスでは 1 つの一時的なバケットを作成し、各クラスターのレジストリーコンポーネントがバケットを作成するため、AWS アカウントごとに 99 の OpenShift Container Platform クラスターのみを作成できます。

セキュリティーグループ

250

アカウントごとに 2,500

各クラスターは、10 の個別のセキュリティーグループを作成します。

1.1.3. 必要な AWS パーミッション

AdministratorAccess ポリシーを、作成する IAM ユーザーに割り当てる場合、そのユーザーには必要なパーミッションすべてを付与します。OpenShift Container Platform クラスターをデプロイするために、IAM ユーザーに以下のパーミッションが必要になります。

インストールに必要な EC2 パーミッション

  • ec2:AllocateAddress
  • ec2:AssociateAddress
  • ec2:AssociateDhcpOptions
  • ec2:AssociateRouteTable
  • ec2:AttachInternetGateway
  • ec2:AuthorizeSecurityGroupEgress
  • ec2:AuthorizeSecurityGroupIngress
  • ec2:CopyImage
  • ec2:CreateDhcpOptions
  • ec2:CreateInternetGateway
  • ec2:CreateNatGateway
  • ec2:CreateNetworkInterface
  • ec2:CreateRoute
  • ec2:CreateRouteTable
  • ec2:CreateSecurityGroup
  • ec2:CreateSubnet
  • ec2:CreateTags
  • ec2:CreateVpc
  • ec2:CreateVpcEndpoint
  • ec2:CreateVolume
  • ec2:DeleteSnapshot
  • ec2:DeregisterImage
  • ec2:DescribeAccountAttributes
  • ec2:DescribeAddresses
  • ec2:DescribeAvailabilityZones
  • ec2:DescribeDhcpOptions
  • ec2:DescribeImages
  • ec2:DescribeInstanceAttribute
  • ec2:DescribeInstanceCreditSpecifications
  • ec2:DescribeInstances
  • ec2:DescribeInternetGateways
  • ec2:DescribeKeyPairs
  • ec2:DescribeNatGateways
  • ec2:DescribeNetworkAcls
  • ec2:DescribePrefixLists
  • ec2:DescribeRegions
  • ec2:DescribeRouteTables
  • ec2:DescribeSecurityGroups
  • ec2:DescribeSubnets
  • ec2:DescribeTags
  • ec2:DescribeVpcEndpoints
  • ec2:DescribeVpcs
  • ec2:DescribeVpcAttribute
  • ec2:DescribeVolumes
  • ec2:DescribeVpcClassicLink
  • ec2:DescribeVpcClassicLinkDnsSupport
  • ec2:ModifyInstanceAttribute
  • ec2:ModifySubnetAttribute
  • ec2:ModifyVpcAttribute
  • ec2:RevokeSecurityGroupEgress
  • ec2:RunInstances
  • ec2:TerminateInstances
  • ec2:DeleteDhcpOptions
  • ec2:DeleteRoute
  • ec2:RevokeSecurityGroupIngress
  • ec2:DisassociateRouteTable
  • ec2:ReplaceRouteTableAssociation
  • ec2:DeleteRouteTable
  • ec2:DeleteSubnet
  • ec2:DescribeNetworkInterfaces
  • ec2:ModifyNetworkInterfaceAttribute
  • ec2:DeleteNatGateway
  • ec2:DeleteSecurityGroup
  • ec2:DetachInternetGateway
  • ec2:DeleteInternetGateway
  • ec2:ReleaseAddress
  • ec2:DeleteVpc

インストールに必要な Elasticloadbalancing パーミッション

  • elasticloadbalancing:AddTags
  • elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
  • elasticloadbalancing:AttachLoadBalancerToSubnets
  • elasticloadbalancing:CreateListener
  • elasticloadbalancing:CreateLoadBalancer
  • elasticloadbalancing:CreateLoadBalancerListeners
  • elasticloadbalancing:CreateTargetGroup
  • elasticloadbalancing:ConfigureHealthCheck
  • elasticloadbalancing:DeleteLoadBalancer
  • elasticloadbalancing:DeregisterInstancesFromLoadBalancer
  • elasticloadbalancing:DeregisterTargets
  • elasticloadbalancing:DescribeInstanceHealth
  • elasticloadbalancing:DescribeListeners
  • elasticloadbalancing:DescribeLoadBalancers
  • elasticloadbalancing:DescribeLoadBalancerAttributes
  • elasticloadbalancing:DescribeTags
  • elasticloadbalancing:DescribeTargetGroupAttributes
  • elasticloadbalancing:DescribeTargetHealth
  • elasticloadbalancing:ModifyLoadBalancerAttributes
  • elasticloadbalancing:ModifyTargetGroup
  • elasticloadbalancing:ModifyTargetGroupAttributes
  • elasticloadbalancing:RegisterTargets
  • elasticloadbalancing:RegisterInstancesWithLoadBalancer
  • elasticloadbalancing:SetLoadBalancerPoliciesOfListener

インストールに必要な IAM パーミッション

  • iam:AddRoleToInstanceProfile
  • iam:CreateInstanceProfile
  • iam:CreateRole
  • iam:DeleteInstanceProfile
  • iam:DeleteRole
  • iam:DeleteRolePolicy
  • iam:GetInstanceProfile
  • iam:GetRole
  • iam:GetRolePolicy
  • iam:GetUser
  • iam:ListInstanceProfilesForRole
  • iam:ListRoles
  • iam:ListUsers
  • iam:PassRole
  • iam:PutRolePolicy
  • iam:RemoveRoleFromInstanceProfile
  • iam:SimulatePrincipalPolicy
  • iam:TagRole

インストールに必要な Route53 パーミッション

  • route53:ChangeResourceRecordSets
  • route53:ChangeTagsForResource
  • route53:GetChange
  • route53:GetHostedZone
  • route53:CreateHostedZone
  • route53:DeleteHostedZone
  • route53:ListHostedZones
  • route53:ListHostedZonesByName
  • route53:ListResourceRecordSets
  • route53:ListTagsForResource
  • route53:UpdateHostedZoneComment

インストールに必要な S3 パーミッション

  • s3:CreateBucket
  • s3:DeleteBucket
  • s3:GetAccelerateConfiguration
  • s3:GetBucketCors
  • s3:GetBucketLocation
  • s3:GetBucketLogging
  • s3:GetBucketObjectLockConfiguration
  • s3:GetBucketReplication
  • s3:GetBucketRequestPayment
  • s3:GetBucketTagging
  • s3:GetBucketVersioning
  • s3:GetBucketWebsite
  • s3:GetEncryptionConfiguration
  • s3:GetLifecycleConfiguration
  • s3:GetReplicationConfiguration
  • s3:ListBucket
  • s3:PutBucketAcl
  • s3:PutBucketTagging
  • s3:PutEncryptionConfiguration

クラスター Operator が必要とする S3 パーミッション

  • s3:PutObject
  • s3:PutObjectAcl
  • s3:PutObjectTagging
  • s3:GetObject
  • s3:GetObjectAcl
  • s3:GetObjectTagging
  • s3:GetObjectVersion
  • s3:DeleteObject

クラスターのアンインストールに必要な追加のすべてのパーミッション

  • autoscaling:DescribeAutoScalingGroups
  • ec2:DeleteNetworkInterface
  • ec2:DeleteVolume
  • ec2:DeleteVpcEndpoints
  • elasticloadbalancing:DescribeTargetGroups
  • elasticloadbalancing:DeleteTargetGroup
  • iam:ListInstanceProfiles
  • iam:ListRolePolicies
  • iam:ListUserPolicies
  • tag:GetResources

マニフェストの作成に必要な追加の IAM および S3 パーミッション

  • iam:CreateAccessKey
  • iam:CreateUser
  • iam:DeleteAccessKey
  • iam:DeleteUser
  • iam:DeleteUserPolicy
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • iam:PutUserPolicy
  • iam:TagUser
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • s3:PutBucketPublicAccessBlock
  • s3:GetBucketPublicAccessBlock
  • s3:PutLifecycleConfiguration
  • s3:HeadBucket
  • s3:ListBucketMultipartUploads
  • s3:AbortMultipartUpload

1.1.4. IAM ユーザーの作成

各 Amazon Web Services (AWS) アカウントには、アカウントの作成に使用するメールアドレスに基づく root ユーザーアカウントが含まれます。これは高度な権限が付与されたアカウントであり、初期アカウントにのみ使用し、請求設定また初期のユーザーセットの作成およびアカウントのセキュリティー保護のために使用することが推奨されています。

OpenShift Container Platform をインストールする前に、セカンダリー IAM 管理ユーザーを作成します。AWS ドキュメントの「Creating an IAM User in Your AWS Account」手順を実行する際に、以下のオプションを設定します。

手順

  1. IAM ユーザー名を指定し、Programmatic access を選択します。
  2. AdministratorAccess ポリシーを割り当て、アカウントにクラスターを作成するために十分なパーミッションがあることを確認します。このポリシーはクラスターに対し、各 OpenShift Container Platform コンポーネントに認証情報を付与する機能を提供します。クラスターはコンポーネントに対し、それらが必要とする認証情報のみを付与します。

    注記

    必要なすべての AWS パーミッションを付与し、これをユーザーに割り当てるポリシーを作成することは可能ですが、これは優先されるオプションではありません。クラスターには追加の認証情報を個別コンポーネントに付与する機能がないため、同じ認証情報がすべてのコンポーネントによって使用されます。

  3. オプション: タグを割り当て、メタデータをユーザーに追加します。
  4. 指定したユーザー名に AdministratorAccess ポリシーが付与されていることを確認します。
  5. アクセスキー ID およびシークレットアクセスキーの値を記録します。ローカルマシンをインストールプログラムを実行するように設定する際にこれらの値を使用する必要があります。

    重要

    クラスターのデプロイ時に、マルチファクター認証デバイスの使用中に生成した一時的なセッショントークンを使用して AWS に対する認証を行うことはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、キーをベースとした有効期間の長い認証情報を使用する必要があります。

1.1.5. サポートされている AWS リージョン

OpenShift Container Platform クラスターを以下のリージョンにデプロイできます。

  • ap-northeast-1 (Tokyo)
  • ap-northeast-2 (Seoul)
  • ap-south-1 (Mumbai)
  • ap-southeast-1 (Singapore)
  • ap-southeast-2 (Sydney)
  • ca-central-1 (Central)
  • eu-central-1 (Frankfurt)
  • eu-north-1 (Stockholm)
  • eu-west-1 (Ireland)
  • eu-west-2 (London)
  • eu-west-3 (Paris)
  • sa-east-1 (São Paulo)
  • us-east-1 (N. Virginia)
  • us-east-2 (Ohio)
  • us-west-1 (N. California)
  • us-west-2 (Oregon)

1.2. クラスターの AWS へのクイックインストール

OpenShift Container Platform バージョン 4.2 では、デフォルトの設定オプションを使用してクラスターを Amazon Web Services (AWS) にインストールできます。

前提条件

  • OpenShift Container Platform のインストールおよび更新プロセスについての詳細を確認します。
  • AWS アカウントを設定してクラスターをホストします。

    重要

    AWS プロファイルがご使用のコンピューターに保存されている場合、マルチファクター認証デバイスを使用中に生成した一時的なセッショントークンを使用することはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、キーをベースとした有効期間の長い認証情報を使用する必要があります。適切なキーを生成するには、AWS ドキュメントの「Managing Access Keys for IAM Users」を参照してください。キーは、インストールプログラムの実行時に指定できます。

  • ファイアウォールを使用する場合、クラスターがアクセスを必要とするサイトを許可するようにファイアウォールを設定する必要があります。

1.2.1. OpenShift Container Platform のインターネットアクセスおよび Telemetry アクセス

OpenShift Container Platform 4.2 では、クラスターをインストールするためにインターネットアクセスが必要になります。クラスターの健全性および正常に実行された更新についてのメトリクスを提供するためにデフォルトで実行される Telemetry サービスにもインターネットアクセスが必要です。クラスターがインターネットに接続されている場合、Telemetry は自動的に実行され、クラスターは Red Hat OpenShift Cluster Manager (OCM) に登録されます。

Red Hat OpenShift Cluster Manager インベントリーが Telemetry によって自動的に維持されるか、または OCM を手動で使用しているかのいずれによって正常であることを確認した後に、subscription watch を使用して、アカウントまたはマルチクラスターレベルで OpenShift Container Platform サブスクリプションを追跡します。

インターネットへのアクセスは以下を実行するために必要です。

  • Red Hat OpenShift Cluster Manager ページにアクセスし、インストールプログラムをダウンロードし、サブスクリプション管理を実行します。クラスターにインターネットアクセスがあり、Telemetry を無効にしない場合、そのサービスは有効なサブスクリプションでクラスターを自動的に使用します。
  • クラスターのインストールに必要なパッケージを取得するために Quay.io にアクセスします。
  • クラスターの更新を実行するために必要なパッケージを取得します。
重要

クラスターでインターネットに直接アクセスできない場合、プロビジョニングする一部のタイプのインフラストラクチャーでネットワークが制限されたインストールを実行できます。このプロセスで、必要なコンテンツをダウンロードし、これを使用してミラーレジストリーにクラスターのインストールおよびインストールプログラムの生成に必要なパッケージを設定します。 インストールタイプによっては、クラスターのインストール環境でインターネットアクセスが不要となる場合があります。クラスターを更新する前に、ミラーレジストリーのコンテンツを更新します。

1.2.2. SSH プライベートキーの生成およびエージェントへの追加

クラスターでインストールのデバッグまたは障害復旧を実行する必要がある場合、ssh-agent とインストールプログラムの両方に SSH キーを指定する必要があります。

注記

実稼働環境では、障害復旧およびデバッグが必要です。

このキーを使用して、ユーザー core としてマスターノードに対して SSH を実行できます。クラスターをデプロイする際に、キーは core ユーザーの ~/.ssh/authorized_keys 一覧に追加されます。

注記

AWS キーペアなどのプラットフォームに固有の方法で設定したキーではなく、ローカルキーを使用する必要があります。

手順

  1. パスワードなしの認証に設定されている SSH キーがコンピューター上にない場合は、これを作成します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ ssh-keygen -t rsa -b 4096 -N '' \
        -f <path>/<file_name> 1
    1
    ~/.ssh/id_rsa などの、SSH キーのパスおよびファイル名を指定します。

    このコマンドを実行すると、指定した場所にパスワードを必要としない SSH キーが生成されます。

  2. ssh-agent プロセスをバックグラウンドタスクとして開始します。

    $ eval "$(ssh-agent -s)"
    
    Agent pid 31874
  3. SSH プライベートキーを ssh-agent に追加します。

    $ ssh-add <path>/<file_name> 1
    
    Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
    1
    ~/.ssh/id_rsa などの、SSH プライベートキーのパスおよびファイル名を指定します。

次のステップ

  • OpenShift Container Platform をインストールする際に、SSH パブリックキーをインストールプログラムに指定します。

1.2.3. インストールプログラムの取得

OpenShift Container Platform をインストールする前に、インストールファイルを

ローカルコンピューターにダウンロードします。

前提条件

  • Linux または macOS を使用するコンピューターからクラスターをインストールする必要があります。
  • インストールプログラムをダウンロードするには、500 MB のローカルディスク領域が必要です。

手順

  1. Red Hat OpenShift Cluster Manager サイトの「Infrastructure Provider」ページにアクセスします。Red Hat アカウントがある場合は、認証情報を使ってログインします。アカウントがない場合はこれを作成します。
  2. 選択するインストールタイプのページに移動し、オペレーティングシステムのインストールプログラムをダウンロードし、ファイルをインストール設定ファイルを保存するディレクトリーに配置します。

    重要

    インストールプログラムは、クラスターのインストールに使用するコンピューターにいくつかのファイルを作成します。クラスターインストールの完了後は、インストールプログラムおよびインストールプログラムが作成するファイルの両方を保持する必要があります。

  3. インストールプログラムを展開します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ tar xvf <installation_program>.tar.gz
  4. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから、インストールプルシークレットを .txt ファイルとしてダウンロードします。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する、Quay.io などの組み込まれた各種の認証局によって提供されるサービスで認証できます。

1.2.4. クラスターのデプロイ

互換性のあるクラウドプラットフォームに OpenShift Container Platform をインストールできます。

重要

インストールプログラムの create cluster コマンドは、初期インストール時に 1 回だけ実行できます。

前提条件

  • クラスターをホストするクラウドプラットフォームでアカウントを設定します。
  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. インストールプログラムを実行します。

    $ ./openshift-install create cluster --dir=<installation_directory> \ 1
        --log-level=info 2
    1
    <installation_directory> には、インストールプログラムが作成するファイルを保存するためにディレクトリー名を指定します。
    2
    異なるインストールの詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。
    重要

    空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    プロンプト時に値を指定します。

    1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

      注記

      インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

    2. ターゲットに設定するプラットフォームとして aws を選択します。
    3. Amazon Web Services (AWS) プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
    4. クラスターのデプロイ先とする AWS リージョンを選択します。
    5. クラスターに設定した Route53 サービスのベースドメインを選択します。
    6. クラスターの記述名を入力します。
    7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
    注記

    ホストに設定した AWS アカウントにクラスターをデプロイするための十分なパーミッションがない場合、インストールプログラムは停止し、不足しているパーミッションが表示されます。

    クラスターのデプロイメントが完了すると、Web コンソールへのリンクや kubeadmin ユーザーの認証情報を含む、クラスターにアクセスするための指示がターミナルに表示されます。

    重要

    インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

    重要

    インストールプログラム、またはインストールプログラムが作成するファイルを削除することはできません。これらはいずれもクラスターを削除するために必要になります。

  2. オプション: クラスターのインストールに使用した IAM アカウントから AdministratorAccess ポリシーを削除するか、または無効にします。

1.2.5. CLI のインストール

コマンドラインインターフェースを使用して OpenShift Container Platform と対話するために CLI をインストールすることができます。

重要

以前のバージョンの oc をインストールしている場合、これを使用して OpenShift Container Platform 4.2 のすべてのコマンドを実行することはできません。新規バージョンの ocをダウンロードし、インストールします。

手順

  1. Red Hat OpenShift Cluster Manager サイトの Infrastructure Provider ページから、選択するインストールタイプのページに移動し、Download Command-line Tools をクリックします。
  2. オペレーティングシステムおよびアーキテクチャーのフォルダーをクリックしてから、圧縮されたファイルをクリックします。

    注記

    oc は Linux、Windows、または macOS にインストールできます。

  3. ファイルをファイルシステムに保存します。
  4. 圧縮ファイルを展開します。
  5. これを PATH にあるディレクトリーに配置します。

CLI のインストール後は、oc コマンドを使用して利用できます。

$ oc <command>

1.2.6. クラスターへのログイン

クラスター kubeconfig ファイルをエクスポートし、デフォルトシステムユーザーとしてクラスターにログインできます。kubeconfig ファイルには、クライアントを正しいクラスターおよび API サーバーに接続するために CLI で使用されるクラスターについての情報が含まれます。このファイルはクラスターに固有のファイルであり、OpenShift Container Platform のインストール時に作成されます。

前提条件

  • OpenShift Container Platform クラスターのデプロイ。
  • oc CLI のインストール。

手順

  1. kubeadmin 認証情報をエクスポートします。

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
  2. エクスポートされた設定を使用して、oc コマンドを正常に実行できることを確認します。

    $ oc whoami
    system:admin

次のステップ

1.3. カスタマイズによる AWS へのクラスターのインストール

OpenShift Container Platform バージョン 4.2 では、インストールプログラムが Amazon Web Services (AWS) にプロビジョニングするインフラストラクチャーにカスタマイズされたクラスターをインストールできます。インストールをカスタマイズするには、クラスターをインストールする前に、install-config.yaml ファイルでパラメーターを変更します。

前提条件

  • OpenShift Container Platform のインストールおよび更新プロセスについての詳細を確認します。
  • AWS アカウントを設定してクラスターをホストします。

    重要

    AWS プロファイルがご使用のコンピューターに保存されている場合、マルチファクター認証デバイスを使用中に生成した一時的なセッショントークンを使用することはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、有効期間の長い認証情報を使用する必要があります。適切なキーを生成するには、AWS ドキュメントの「Managing Access Keys for IAM Users」を参照してください。キーは、インストールプログラムの実行時に指定できます。

  • ファイアウォールを使用する場合、クラスターがアクセスを必要とするサイトを許可するようにファイアウォールを設定する必要があります。

1.3.1. OpenShift Container Platform のインターネットアクセスおよび Telemetry アクセス

OpenShift Container Platform 4.2 では、クラスターをインストールするためにインターネットアクセスが必要になります。クラスターの健全性および正常に実行された更新についてのメトリクスを提供するためにデフォルトで実行される Telemetry サービスにもインターネットアクセスが必要です。クラスターがインターネットに接続されている場合、Telemetry は自動的に実行され、クラスターは Red Hat OpenShift Cluster Manager (OCM) に登録されます。

Red Hat OpenShift Cluster Manager インベントリーが Telemetry によって自動的に維持されるか、または OCM を手動で使用しているかのいずれによって正常であることを確認した後に、subscription watch を使用して、アカウントまたはマルチクラスターレベルで OpenShift Container Platform サブスクリプションを追跡します。

インターネットへのアクセスは以下を実行するために必要です。

  • Red Hat OpenShift Cluster Manager ページにアクセスし、インストールプログラムをダウンロードし、サブスクリプション管理を実行します。クラスターにインターネットアクセスがあり、Telemetry を無効にしない場合、そのサービスは有効なサブスクリプションでクラスターを自動的に使用します。
  • クラスターのインストールに必要なパッケージを取得するために Quay.io にアクセスします。
  • クラスターの更新を実行するために必要なパッケージを取得します。
重要

クラスターでインターネットに直接アクセスできない場合、プロビジョニングする一部のタイプのインフラストラクチャーでネットワークが制限されたインストールを実行できます。このプロセスで、必要なコンテンツをダウンロードし、これを使用してミラーレジストリーにクラスターのインストールおよびインストールプログラムの生成に必要なパッケージを設定します。 インストールタイプによっては、クラスターのインストール環境でインターネットアクセスが不要となる場合があります。クラスターを更新する前に、ミラーレジストリーのコンテンツを更新します。

1.3.2. SSH プライベートキーの生成およびエージェントへの追加

クラスターでインストールのデバッグまたは障害復旧を実行する必要がある場合、ssh-agent とインストールプログラムの両方に SSH キーを指定する必要があります。

注記

実稼働環境では、障害復旧およびデバッグが必要です。

このキーを使用して、ユーザー core としてマスターノードに対して SSH を実行できます。クラスターをデプロイする際に、キーは core ユーザーの ~/.ssh/authorized_keys 一覧に追加されます。

注記

AWS キーペアなどのプラットフォームに固有の方法で設定したキーではなく、ローカルキーを使用する必要があります。

手順

  1. パスワードなしの認証に設定されている SSH キーがコンピューター上にない場合は、これを作成します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ ssh-keygen -t rsa -b 4096 -N '' \
        -f <path>/<file_name> 1
    1
    ~/.ssh/id_rsa などの、SSH キーのパスおよびファイル名を指定します。

    このコマンドを実行すると、指定した場所にパスワードを必要としない SSH キーが生成されます。

  2. ssh-agent プロセスをバックグラウンドタスクとして開始します。

    $ eval "$(ssh-agent -s)"
    
    Agent pid 31874
  3. SSH プライベートキーを ssh-agent に追加します。

    $ ssh-add <path>/<file_name> 1
    
    Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
    1
    ~/.ssh/id_rsa などの、SSH プライベートキーのパスおよびファイル名を指定します。

次のステップ

  • OpenShift Container Platform をインストールする際に、SSH パブリックキーをインストールプログラムに指定します。

1.3.3. インストールプログラムの取得

OpenShift Container Platform をインストールする前に、インストールファイルを

ローカルコンピューターにダウンロードします。

前提条件

  • Linux または macOS を使用するコンピューターからクラスターをインストールする必要があります。
  • インストールプログラムをダウンロードするには、500 MB のローカルディスク領域が必要です。

手順

  1. Red Hat OpenShift Cluster Manager サイトの「Infrastructure Provider」ページにアクセスします。Red Hat アカウントがある場合は、認証情報を使ってログインします。アカウントがない場合はこれを作成します。
  2. 選択するインストールタイプのページに移動し、オペレーティングシステムのインストールプログラムをダウンロードし、ファイルをインストール設定ファイルを保存するディレクトリーに配置します。

    重要

    インストールプログラムは、クラスターのインストールに使用するコンピューターにいくつかのファイルを作成します。クラスターインストールの完了後は、インストールプログラムおよびインストールプログラムが作成するファイルの両方を保持する必要があります。

  3. インストールプログラムを展開します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ tar xvf <installation_program>.tar.gz
  4. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから、インストールプルシークレットを .txt ファイルとしてダウンロードします。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する Quay.io など、組み込まれた各種の認証局によって提供されるサービスで認証できます。

1.3.4. インストール設定ファイルの作成

Amazon Web Services (AWS) での OpenShift Container Platform のインストールをカスタマイズできます。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. install-config.yaml ファイルを作成します。

    1. 次のコマンドを実行します。

      $ ./openshift-install create install-config --dir=<installation_directory> 1
      1
      <installation_directory> には、インストールプログラムが作成するファイルを保存するためにディレクトリー名を指定します。
      重要

      空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    2. プロンプト時に、クラウドの設定の詳細情報を指定します。

      1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

        注記

        インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

      2. ターゲットに設定するプラットフォームとして AWS を選択します。
      3. Amazon Web Services (AWS) プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
      4. クラスターのデプロイ先とする AWS リージョンを選択します。
      5. クラスターに設定した Route53 サービスのベースドメインを選択します。
      6. クラスターの記述名を入力します。
      7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
  2. install-config.yaml ファイルを変更します。利用可能なパラメーターの詳細については、「インストール設定パラメーター」セクションを参照してください。
  3. install-config.yaml ファイルをバックアップし、これを複数のクラスターをインストールするために使用できるようにします。

    重要

    install-config.yaml ファイルはインストールプロセス時に使用されます。このファイルを再利用する必要がある場合は、この段階でこれをバックアップしてください。

1.3.4.1. インストール設定パラメーター

OpenShift Container Platform クラスターをデプロイする前に、クラスターをホストするクラウドプラットフォームでアカウントを記述し、クラスターのプラットフォームをオプションでカスタマイズするためにパラメーターの値を指定します。 install-config.yaml インストール設定ファイルを作成する際に、コマンドラインで必要なパラメーターの値を指定します。クラスターをカスタマイズする場合、install-config.yaml ファイルを変更して、プラットフォームについての詳細情報を指定できます。

注記

インストール後は、install-config.yaml ファイルでこれらのパラメーターを変更することはできません。

表1.1 必須パラメーター

パラメーター説明

baseDomain

クラウドプロバイダーのベースドメイン。この値は、OpenShift Container Platform クラスターコンポーネントへのルートを作成するために使用されます。クラスターの完全な DNS 名は、baseDomain<metadata.name>.<baseDomain> 形式を使用する metadata.name パラメーターの値の組み合わせです。

example.com などの完全修飾ドメインまたはサブドメイン名。

controlPlane.platform

コントロールプレーンマシンをホストするためのクラウドプロバイダー。このパラメーターの値は compute.platform パラメーターの値に一致する必要があります。

awsazuregcpopenstack、または {}

compute.platform

ワーカーマシンをホストするためのクラウドプロバイダー。このパラメーターの値は controlPlane.platform パラメーターの値に一致する必要があります。

awsazuregcpopenstack、または {}

metadata.name

クラスターの名前。

dev などの大文字または小文字を含む文字列。

platform.<platform>.region

クラスターをデプロイするリージョン。

AWS の us-east-1、Azure の centralus、または Red Hat OpenStack Platform (RHOSP) の region1 などのクラウドの有効なリージョン。

pullSecret

Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレット。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する、Quay.io などの組み込まれた各種の認証局によって提供されるサービスで認証できます。

{
   "auths":{
      "cloud.openshift.com":{
         "auth":"b3Blb=",
         "email":"you@example.com"
      },
      "quay.io":{
         "auth":"b3Blb=",
         "email":"you@example.com"
      }
   }
}

表1.2 オプションのパラメーター

パラメーター説明

sshKey

クラスターマシンにアクセスするために使用する SSH キー。

注記

インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

ssh-agent プロセスに追加した、有効なローカルのパブリック SSH キー。

compute.hyperthreading

コンピュートマシンで同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。

重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。

Enabled または Disabled

compute.replicas

プロビジョニングするコンピュートマシン(ワーカーマシンとしても知られる)の数。

2 以上の正の整数。デフォルト値は 3 です。

controlPlane.hyperthreading

コントロールプレーンマシンで同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。

重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。

Enabled または Disabled

controlPlane.replicas

プロビジョニングするコントロールプレーンマシンの数。

3 以上の正の整数。デフォルト値は 3 です。

表1.3 オプションの AWS パラメーター

パラメーター説明

compute.platform.aws.rootVolume.iops

ルートボリュームに予約される 1 秒あたりの入出力操作 (IOPS)。

整数 (例: 4000)。

compute.platform.aws.rootVolume.size

ルートボリュームのサイズ (GiB)。

整数 (例: 500)。

compute.platform.aws.rootVolume.type

ルートボリュームのインスタンスタイプ。

有効な AWS EBS インスタンスタイプ (例: io1)。

compute.platform.aws.type

コンピュートマシンの EC2 インスタンスタイプ。

有効な AWS インスタンスタイプ (例: c5.9xlarge)。

compute.platform.aws.zones

インストールプログラムがコンピュート MachinePool のマシンを作成するアベイラビリティーゾーン。

YAML シーケンスus-east-1c などの有効な AWS アベイラビリティーゾーンの一覧。

compute.aws.region

インストールプログラムがコンピュートリソースを作成する AWS リージョン。

有効な AWS リージョン (例: us-east-1)。

controlPlane.platform.aws.type

コントロールプレーンマシンの EC2 インスタンスタイプ。

有効な AWS インスタンスタイプ (例: c5.9xlarge)。

controlPlane.platform.aws.zones

インストールプログラムがコントロールプレーン MachinePool のマシンを作成するアベイラビリティーゾーン。

YAML シーケンスus-east-1c などの有効な AWS アベイラビリティーゾーンの一覧。

controlPlane.aws.region

インストールプログラムがコントロールプレーンのリソースを作成する AWS リージョン。

有効な AWS リージョン (例: us-east-1)。

platform.aws.userTags

インストールプログラムが、作成するすべてのリソースに対するタグとして追加するキーと値のマップ。

<key>: <value> 形式のキー値ペアなどの有効な YAML マップ。AWS タグについての詳細は、AWS ドキュメントの「Tagging Your Amazon EC2 Resources」を参照してください。

1.3.4.2. AWS のカスタマイズされた install-config.yaml ファイルのサンプル

install-config.yaml ファイルをカスタマイズして、OpenShift Container Platform クラスターのプラットフォームについての詳細を指定するか、または必要なパラメーターの値を変更することができます。

重要

このサンプルの YAML ファイルは参照用にのみ提供されます。インストールプログラムを使用して install-config.yaml ファイルを取得し、これを変更する必要があります。

apiVersion: v1
baseDomain: example.com 1
controlPlane: 2
  hyperthreading: Enabled 3 4
  name: master
  platform:
    aws:
      zones:
      - us-west-2a
      - us-west-2b
      rootVolume:
        iops: 4000
        size: 500
        type: io1
      type: m5.xlarge 5
  replicas: 3
compute: 6
- hyperthreading: Enabled 7
  name: worker
  platform:
    aws:
      rootVolume:
        iops: 2000
        size: 500
        type: io1 8
      type: c5.4xlarge
      zones:
      - us-west-2c
  replicas: 3
metadata:
  name: test-cluster 9
networking:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  machineCIDR: 10.0.0.0/16
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16
platform:
  aws:
    region: us-west-2 10
    userTags:
      adminContact: jdoe
      costCenter: 7536
pullSecret: '{"auths": ...}' 11
sshKey: ssh-ed25519 AAAA... 12
1 9 10 11
必須。インストールプログラムはこの値の入力を求めるプロンプトを出します。
2 6
これらのパラメーターおよび値を指定しない場合、インストールプログラムはデフォルトの値を指定します。
3 7
controlPlane セクションは単一マッピングですが、コンピュートセクションはマッピングのシーケンスになります。複数の異なるデータ構造の要件を満たすには、 compute セクションの最初の行はハイフン - で始め、controlPlane セクションの最初の行はハイフンで始めることができません。どちらのセクションも、現時点では単一のマシンプールを定義しますが、OpenShift Container Platform の今後のバージョンでは、インストール時の複数のコンピュートプールの定義をサポートする可能性があります。1 つのコントロールプレーンプールのみが使用されます。
4 5
同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。パラメーター値を Disabled に設定するとこれを無効にすることができます。一部のクラスターマシンで同時マルチスレッドを無効にする場合は、これをすべてのクラスターマシンで無効にする必要があります。
重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。同時マルチスレッドを無効にする場合は、マシンに対して m4.2xlarge または m5.2xlarge などの大規模なインスタンスタイプを使用します。

8
大規模なクラスターの場合などに etcd の高速のストレージを設定するには、ストレージタイプを io1 として設定し、iops2000 に設定します。
12
クラスター内のマシンにアクセスするために使用する sshKey 値をオプションで指定できます。
注記

インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

1.3.5. クラスターのデプロイ

互換性のあるクラウドプラットフォームに OpenShift Container Platform をインストールできます。

重要

インストールプログラムの create cluster コマンドは、初期インストール時に 1 回だけ実行できます。

前提条件

  • クラスターをホストするクラウドプラットフォームでアカウントを設定します。
  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. インストールプログラムを実行します。

    $ ./openshift-install create cluster --dir=<installation_directory> \ 1
        --log-level=info 2
    1
    <installation_directory> については、カスタマイズされた ./install-config.yaml ファイルの場所を指定します。これは、インストールプログラムが作成するファイルを保存するためのディレクトリーの名前です。
    2
    異なるインストールの詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。
    重要

    空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    プロンプト時に値を指定します。

    1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

      注記

      インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

    2. ターゲットに設定するプラットフォームとして aws を選択します。
    3. Amazon Web Services (AWS) プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
    4. クラスターのデプロイ先とする AWS リージョンを選択します。
    5. クラスターに設定した Route53 サービスのベースドメインを選択します。
    6. クラスターの記述名を入力します。
    7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
    注記

    ホストに設定した AWS アカウントにクラスターをデプロイするための十分なパーミッションがない場合、インストールプログラムは停止し、不足しているパーミッションが表示されます。

    クラスターのデプロイメントが完了すると、Web コンソールへのリンクや kubeadmin ユーザーの認証情報を含む、クラスターにアクセスするための指示がターミナルに表示されます。

    重要

    インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

    重要

    インストールプログラム、またはインストールプログラムが作成するファイルを削除することはできません。これらはいずれもクラスターを削除するために必要になります。

  2. オプション: クラスターのインストールに使用した IAM アカウントから AdministratorAccess ポリシーを削除するか、または無効にします。

1.3.6. CLI のインストール

コマンドラインインターフェースを使用して OpenShift Container Platform と対話するために CLI をインストールすることができます。

重要

以前のバージョンの oc をインストールしている場合、これを使用して OpenShift Container Platform 4.2 のすべてのコマンドを実行することはできません。新規バージョンの ocをダウンロードし、インストールします。

手順

  1. Red Hat OpenShift Cluster Manager サイトの Infrastructure Provider ページから、選択するインストールタイプのページに移動し、Download Command-line Tools をクリックします。
  2. オペレーティングシステムおよびアーキテクチャーのフォルダーをクリックしてから、圧縮されたファイルをクリックします。

    注記

    oc は Linux、Windows、または macOS にインストールできます。

  3. ファイルをファイルシステムに保存します。
  4. 圧縮ファイルを展開します。
  5. これを PATH にあるディレクトリーに配置します。

CLI のインストール後は、oc コマンドを使用して利用できます。

$ oc <command>

1.3.7. クラスターへのログイン

クラスター kubeconfig ファイルをエクスポートし、デフォルトシステムユーザーとしてクラスターにログインできます。kubeconfig ファイルには、クライアントを正しいクラスターおよび API サーバーに接続するために CLI で使用されるクラスターについての情報が含まれます。このファイルはクラスターに固有のファイルであり、OpenShift Container Platform のインストール時に作成されます。

前提条件

  • OpenShift Container Platform クラスターのデプロイ。
  • oc CLI のインストール。

手順

  1. kubeadmin 認証情報をエクスポートします。

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
  2. エクスポートされた設定を使用して、oc コマンドを正常に実行できることを確認します。

    $ oc whoami
    system:admin

次のステップ

1.4. ネットワークのカスタマイズによる AWS へのクラスターのインストール

OpenShift Container Platform バージョン 4.2 では、カスタマイズされたネットワーク設定オプションでクラスターを Amazon Web Services (AWS) にインストールできます。ネットワーク設定をカスタマイズすることにより、クラスターは環境内の既存の IP アドレスの割り当てと共存でき、既存の MTU および VXLAN 設定と統合できます。

大半のネットワーク設定パラメーターはインストール時に設定する必要があり、実行中のクラスターで変更できるのは kubeProxy 設定パラメーターのみになります。

前提条件

  • OpenShift Container Platform のインストールおよび更新プロセスについての詳細を確認します。
  • AWS アカウントを設定してクラスターをホストします。

    重要

    AWS プロファイルがご使用のコンピューターに保存されている場合、マルチファクター認証デバイスを使用中に生成した一時的なセッショントークンを使用することはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、キーをベースとした有効期間の長い認証情報を使用する必要があります。適切なキーを生成するには、AWS ドキュメントの「Managing Access Keys for IAM Users」を参照してください。キーは、インストールプログラムの実行時に指定できます。

  • ファイアウォールを使用する場合、クラスターがアクセスを必要とするサイトを許可するようにファイアウォールを設定する必要があります。

1.4.1. OpenShift Container Platform のインターネットアクセスおよび Telemetry アクセス

OpenShift Container Platform 4.2 では、クラスターをインストールするためにインターネットアクセスが必要になります。クラスターの健全性および正常に実行された更新についてのメトリクスを提供するためにデフォルトで実行される Telemetry サービスにもインターネットアクセスが必要です。クラスターがインターネットに接続されている場合、Telemetry は自動的に実行され、クラスターは Red Hat OpenShift Cluster Manager (OCM) に登録されます。

Red Hat OpenShift Cluster Manager インベントリーが Telemetry によって自動的に維持されるか、または OCM を手動で使用しているかのいずれによって正常であることを確認した後に、subscription watch を使用して、アカウントまたはマルチクラスターレベルで OpenShift Container Platform サブスクリプションを追跡します。

インターネットへのアクセスは以下を実行するために必要です。

  • Red Hat OpenShift Cluster Manager ページにアクセスし、インストールプログラムをダウンロードし、サブスクリプション管理を実行します。クラスターにインターネットアクセスがあり、Telemetry を無効にしない場合、そのサービスは有効なサブスクリプションでクラスターを自動的に使用します。
  • クラスターのインストールに必要なパッケージを取得するために Quay.io にアクセスします。
  • クラスターの更新を実行するために必要なパッケージを取得します。
重要

クラスターでインターネットに直接アクセスできない場合、プロビジョニングする一部のタイプのインフラストラクチャーでネットワークが制限されたインストールを実行できます。このプロセスで、必要なコンテンツをダウンロードし、これを使用してミラーレジストリーにクラスターのインストールおよびインストールプログラムの生成に必要なパッケージを設定します。 インストールタイプによっては、クラスターのインストール環境でインターネットアクセスが不要となる場合があります。クラスターを更新する前に、ミラーレジストリーのコンテンツを更新します。

1.4.2. SSH プライベートキーの生成およびエージェントへの追加

クラスターでインストールのデバッグまたは障害復旧を実行する必要がある場合、ssh-agent とインストールプログラムの両方に SSH キーを指定する必要があります。

注記

実稼働環境では、障害復旧およびデバッグが必要です。

このキーを使用して、ユーザー core としてマスターノードに対して SSH を実行できます。クラスターをデプロイする際に、キーは core ユーザーの ~/.ssh/authorized_keys 一覧に追加されます。

注記

AWS キーペアなどのプラットフォームに固有の方法で設定したキーではなく、ローカルキーを使用する必要があります。

手順

  1. パスワードなしの認証に設定されている SSH キーがコンピューター上にない場合は、これを作成します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ ssh-keygen -t rsa -b 4096 -N '' \
        -f <path>/<file_name> 1
    1
    ~/.ssh/id_rsa などの、SSH キーのパスおよびファイル名を指定します。

    このコマンドを実行すると、指定した場所にパスワードを必要としない SSH キーが生成されます。

  2. ssh-agent プロセスをバックグラウンドタスクとして開始します。

    $ eval "$(ssh-agent -s)"
    
    Agent pid 31874
  3. SSH プライベートキーを ssh-agent に追加します。

    $ ssh-add <path>/<file_name> 1
    
    Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
    1
    ~/.ssh/id_rsa などの、SSH プライベートキーのパスおよびファイル名を指定します。

次のステップ

  • OpenShift Container Platform をインストールする際に、SSH パブリックキーをインストールプログラムに指定します。

1.4.3. インストールプログラムの取得

OpenShift Container Platform をインストールする前に、インストールファイルを

ローカルコンピューターにダウンロードします。

前提条件

  • Linux または macOS を使用するコンピューターからクラスターをインストールする必要があります。
  • インストールプログラムをダウンロードするには、500 MB のローカルディスク領域が必要です。

手順

  1. Red Hat OpenShift Cluster Manager サイトの「Infrastructure Provider」ページにアクセスします。Red Hat アカウントがある場合は、認証情報を使ってログインします。アカウントがない場合はこれを作成します。
  2. 選択するインストールタイプのページに移動し、オペレーティングシステムのインストールプログラムをダウンロードし、ファイルをインストール設定ファイルを保存するディレクトリーに配置します。

    重要

    インストールプログラムは、クラスターのインストールに使用するコンピューターにいくつかのファイルを作成します。クラスターインストールの完了後は、インストールプログラムおよびインストールプログラムが作成するファイルの両方を保持する必要があります。

  3. インストールプログラムを展開します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ tar xvf <installation_program>.tar.gz
  4. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから、インストールプルシークレットを .txt ファイルとしてダウンロードします。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する Quay.io など、組み込まれた各種の認証局によって提供されるサービスで認証できます。

1.4.4. インストール設定ファイルの作成

Amazon Web Services (AWS) での OpenShift Container Platform のインストールをカスタマイズできます。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. install-config.yaml ファイルを作成します。

    1. 次のコマンドを実行します。

      $ ./openshift-install create install-config --dir=<installation_directory> 1
      1
      <installation_directory> には、インストールプログラムが作成するファイルを保存するためにディレクトリー名を指定します。
      重要

      空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    2. プロンプト時に、クラウドの設定の詳細情報を指定します。

      1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

        注記

        インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

      2. ターゲットに設定するプラットフォームとして AWS を選択します。
      3. Amazon Web Services (AWS) プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
      4. クラスターのデプロイ先とする AWS リージョンを選択します。
      5. クラスターに設定した Route53 サービスのベースドメインを選択します。
      6. クラスターの記述名を入力します。
      7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
  2. install-config.yaml ファイルを変更します。利用可能なパラメーターの詳細については、「インストール設定パラメーター」セクションを参照してください。
  3. install-config.yaml ファイルをバックアップし、これを複数のクラスターをインストールするために使用できるようにします。

    重要

    install-config.yaml ファイルはインストールプロセス時に使用されます。このファイルを再利用する必要がある場合は、この段階でこれをバックアップしてください。

1.4.4.1. インストール設定パラメーター

OpenShift Container Platform クラスターをデプロイする前に、クラスターをホストするクラウドプラットフォームでアカウントを記述し、クラスターのプラットフォームをオプションでカスタマイズするためにパラメーターの値を指定します。 install-config.yaml インストール設定ファイルを作成する際に、コマンドラインで必要なパラメーターの値を指定します。クラスターをカスタマイズする場合、install-config.yaml ファイルを変更して、プラットフォームについての詳細情報を指定できます。

注記

インストール後は、install-config.yaml ファイルでこれらのパラメーターを変更することはできません。

表1.4 必須パラメーター

パラメーター説明

baseDomain

クラウドプロバイダーのベースドメイン。この値は、OpenShift Container Platform クラスターコンポーネントへのルートを作成するために使用されます。クラスターの完全な DNS 名は、baseDomain<metadata.name>.<baseDomain> 形式を使用する metadata.name パラメーターの値の組み合わせです。

example.com などの完全修飾ドメインまたはサブドメイン名。

controlPlane.platform

コントロールプレーンマシンをホストするためのクラウドプロバイダー。このパラメーターの値は compute.platform パラメーターの値に一致する必要があります。

awsazuregcpopenstack、または {}

compute.platform

ワーカーマシンをホストするためのクラウドプロバイダー。このパラメーターの値は controlPlane.platform パラメーターの値に一致する必要があります。

awsazuregcpopenstack、または {}

metadata.name

クラスターの名前。

dev などの大文字または小文字を含む文字列。

platform.<platform>.region

クラスターをデプロイするリージョン。

AWS の us-east-1、Azure の centralus、または Red Hat OpenStack Platform (RHOSP) の region1 などのクラウドの有効なリージョン。

pullSecret

Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレット。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する、Quay.io などの組み込まれた各種の認証局によって提供されるサービスで認証できます。

{
   "auths":{
      "cloud.openshift.com":{
         "auth":"b3Blb=",
         "email":"you@example.com"
      },
      "quay.io":{
         "auth":"b3Blb=",
         "email":"you@example.com"
      }
   }
}

表1.5 オプションのパラメーター

パラメーター説明

sshKey

クラスターマシンにアクセスするために使用する SSH キー。

注記

インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

ssh-agent プロセスに追加した、有効なローカルのパブリック SSH キー。

compute.hyperthreading

コンピュートマシンで同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。

重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。

Enabled または Disabled

compute.replicas

プロビジョニングするコンピュートマシン(ワーカーマシンとしても知られる)の数。

2 以上の正の整数。デフォルト値は 3 です。

controlPlane.hyperthreading

コントロールプレーンマシンで同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。

重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。

Enabled または Disabled

controlPlane.replicas

プロビジョニングするコントロールプレーンマシンの数。

3 以上の正の整数。デフォルト値は 3 です。

表1.6 オプションの AWS パラメーター

パラメーター説明

compute.platform.aws.rootVolume.iops

ルートボリュームに予約される 1 秒あたりの入出力操作 (IOPS)。

整数 (例: 4000)。

compute.platform.aws.rootVolume.size

ルートボリュームのサイズ (GiB)。

整数 (例: 500)。

compute.platform.aws.rootVolume.type

ルートボリュームのインスタンスタイプ。

有効な AWS EBS インスタンスタイプ (例: io1)。

compute.platform.aws.type

コンピュートマシンの EC2 インスタンスタイプ。

有効な AWS インスタンスタイプ (例: c5.9xlarge)。

compute.platform.aws.zones

インストールプログラムがコンピュート MachinePool のマシンを作成するアベイラビリティーゾーン。

YAML シーケンスus-east-1c などの有効な AWS アベイラビリティーゾーンの一覧。

compute.aws.region

インストールプログラムがコンピュートリソースを作成する AWS リージョン。

有効な AWS リージョン (例: us-east-1)。

controlPlane.platform.aws.type

コントロールプレーンマシンの EC2 インスタンスタイプ。

有効な AWS インスタンスタイプ (例: c5.9xlarge)。

controlPlane.platform.aws.zones

インストールプログラムがコントロールプレーン MachinePool のマシンを作成するアベイラビリティーゾーン。

YAML シーケンスus-east-1c などの有効な AWS アベイラビリティーゾーンの一覧。

controlPlane.aws.region

インストールプログラムがコントロールプレーンのリソースを作成する AWS リージョン。

有効な AWS リージョン (例: us-east-1)。

platform.aws.userTags

インストールプログラムが、作成するすべてのリソースに対するタグとして追加するキーと値のマップ。

<key>: <value> 形式のキー値ペアなどの有効な YAML マップ。AWS タグについての詳細は、AWS ドキュメントの「Tagging Your Amazon EC2 Resources」を参照してください。

重要

Open Virtual Networking (OVN) Kubernetes ネットワークプラグインは、テクノロジープレビュー機能です。テクノロジープレビュー機能は Red Hat の実稼働環境でのサービスレベルアグリーメント (SLA) ではサポートされていないため、Red Hat では実稼働環境での使用を推奨していません。Red Hat は実稼働環境でこれらを使用することを推奨していません。これらの機能は、近々発表予定の製品機能をリリースに先駆けてご提供することにより、お客様は機能性をテストし、開発プロセス中にフィードバックをお寄せいただくことができます。

OVN テクノロジープレビュー機能のサポート範囲についての詳細は、https://access.redhat.com/articles/4380121 を参照してください。

1.4.4.2. ネットワーク設定パラメーター

クラスターのネットワーク設定パラメーターは install-config.yaml 設定ファイルで変更できます。以下の表では、これらのパラメーターについて説明しています。

注記

インストール後は、install-config.yaml ファイルでこれらのパラメーターを変更することはできません。

表1.7 必要なネットワークパラメーター

パラメーター説明

networking.networkType

デプロイするネットワークプラグイン。OpenShiftSDN プラグインのみが OpenShift Container Platform 4.2 でサポートされているプラグインです。OVNKubernetes プラグインは、OpenShift Container Platform 4.2 でテクノロジープレビューとしてご利用いただけます。

OpenShiftSDN または OVNKubernetes のいずれか。デフォルト値は OpenShiftSDN です。

networking.clusterNetwork.cidr

Pod IP アドレスの割り当てに使用する IP アドレスのブロック。OpenShiftSDN ネットワークプラグインは複数のクラスターネットワークをサポートします。複数のクラスターネットワークのアドレスブロックには重複が許可されません。予想されるワークロードに適したサイズのアドレスプールを選択してください。

CIDR 形式の IP アドレスの割り当て。デフォルト値は 10.128.0.0/14 です。

networking.clusterNetwork.hostPrefix

それぞれの個別ノードに割り当てるサブネットプレフィックスの長さ。たとえば、hostPrefix23 に設定される場合、各ノードに指定の cidr から /23 サブネットが割り当てられます (510 (2^(32 - 23) - 2) Pod IP アドレスが許可されます)。

サブネットプレフィックス。デフォルト値は 23 です。

networking.serviceNetwork

サービスの IP アドレスのブロック。OpenShiftSDN は 1 つの serviceNetwork ブロックのみを許可します。このアドレスブロックは他のネットワークブロックと重複できません。

CIDR 形式の IP アドレスの割り当て。デフォルト値は 172.30.0.0/16 です。

networking.machineCIDR

クラスターのインストール中に OpenShift Container Platform インストールプログラムによって使用される IP アドレスのブロック。このアドレスブロックは他のネットワークブロックと重複できません。

CIDR 形式の IP アドレスの割り当て。デフォルト値は 10.0.0.0/16 です。

1.4.4.3. AWS のカスタマイズされた install-config.yaml ファイルのサンプル

install-config.yaml ファイルをカスタマイズして、OpenShift Container Platform クラスターのプラットフォームについての詳細を指定するか、または必要なパラメーターの値を変更することができます。

重要

このサンプルの YAML ファイルは参照用にのみ提供されます。インストールプログラムを使用して install-config.yaml ファイルを取得し、これを変更する必要があります。

apiVersion: v1
baseDomain: example.com 1
controlPlane: 2
  hyperthreading: Enabled 3 4
  name: master
  platform:
    aws:
      zones:
      - us-west-2a
      - us-west-2b
      rootVolume:
        iops: 4000
        size: 500
        type: io1
      type: m5.xlarge 5
  replicas: 3
compute: 6
- hyperthreading: Enabled 7
  name: worker
  platform:
    aws:
      rootVolume:
        iops: 2000
        size: 500
        type: io1 8
      type: c5.4xlarge
      zones:
      - us-west-2c
  replicas: 3
metadata:
  name: test-cluster 9
networking: 10
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  machineCIDR: 10.0.0.0/16
  networkType: OpenShiftSDN
  serviceNetwork:
  - 172.30.0.0/16
platform:
  aws:
    region: us-west-2 11
    userTags:
      adminContact: jdoe
      costCenter: 7536
pullSecret: '{"auths": ...}' 12
sshKey: ssh-ed25519 AAAA... 13
1 9 11 12
必須。インストールプログラムはこの値の入力を求めるプロンプトを出します。
2 6 10
これらのパラメーターおよび値を指定しない場合、インストールプログラムはデフォルトの値を指定します。
3 7
controlPlane セクションは単一マッピングですが、コンピュートセクションはマッピングのシーケンスになります。複数の異なるデータ構造の要件を満たすには、 compute セクションの最初の行はハイフン - で始め、controlPlane セクションの最初の行はハイフンで始めることができません。どちらのセクションも、現時点では単一のマシンプールを定義しますが、OpenShift Container Platform の今後のバージョンでは、インストール時の複数のコンピュートプールの定義をサポートする可能性があります。1 つのコントロールプレーンプールのみが使用されます。
4 5
同時マルチスレッドまたは hyperthreading を有効/無効にするかどうか。デフォルトでは、同時スレッドはマシンのコアのパフォーマンスを上げるために有効にされます。パラメーター値を Disabled に設定するとこれを無効にすることができます。一部のクラスターマシンで同時マルチスレッドを無効にする場合は、これをすべてのクラスターマシンで無効にする必要があります。
重要

同時スレッドを無効にする場合は、容量計画においてマシンパフォーマンスの大幅な低下が考慮に入れられていることを確認します。同時マルチスレッドを無効にする場合は、マシンに対して m4.2xlarge または m5.2xlarge などの大規模なインスタンスタイプを使用します。

8
大規模なクラスターの場合などに etcd の高速のストレージを設定するには、ストレージタイプを io1 として設定し、iops2000 に設定します。
13
クラスター内のマシンにアクセスするために使用する sshKey 値をオプションで指定できます。
注記

インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

1.4.5. 高度なネットワーク設定パラメーターの変更

高度なネットワーク設定パラメーターは、クラスターのインストール前にのみ変更することができます。高度な設定のカスタマイズにより、クラスターを既存のネットワーク環境に統合させることができます。 これを実行するには、MTU または VXLAN ポートを指定し、kube-proxy 設定のカスタマイズを許可し、openshiftSDNConfig パラメーターに異なる mode を指定します。

重要

OpenShift Container Platform マニフェストファイルの直接の変更はサポートされていません。

前提条件

  • install-config.yaml ファイルを作成し、これに対する変更を完了します。

手順

  1. 以下のコマンドを使用してマニフェストを作成します。

    $ ./openshift-install create manifests --dir=<installation_directory> 1
    1
    <installation_directory> については、クラスターの install-config.yaml ファイルが含まれるディレクトリーの名前を指定します。
  2. <installation_directory>/manifests/cluster-scheduler-02-config.yml Kubernetes マニフェストファイルを変更し、Pod がコントロールプレーンマシンにスケジュールされないようにします。

    1. manifests/cluster-scheduler-02-config.yml ファイルを開きます。
    2. mastersSchedulable パラメーターを見つけ、その値を False に設定します。
    3. ファイルを保存し、終了します。
    注記

    現時点では、Kubernetes の制限により、コントロールプレーンマシンで実行されるルーター Pod に Ingress ロードバランサーがアクセスすることができません。

  3. cluster-network-03-config.yml という名前のファイルを <installation_directory>/manifests/ ディレクトリーに作成します。

    $ touch <installation_directory>/manifests/cluster-network-03-config.yml 1
    1
    <installation_directory> については、クラスターの manifests/ ディレクトリーが含まれるディレクトリー名を指定します。

    ファイルの作成後は、以下のようにいくつかのネットワーク設定ファイルが manifests/ ディレクトリーに置かれます。

    $ ls <installation_directory>/manifests/cluster-network-*
    cluster-network-01-crd.yml
    cluster-network-02-config.yml
    cluster-network-03-config.yml
  4. エディターで cluster-network-03-config.yml ファイルを開き、必要な Operator 設定を記述する CR を入力します。

    apiVersion: operator.openshift.io/v1
    kind: Network
    metadata:
      name: cluster
    spec: 1
      clusterNetwork:
      - cidr: 10.128.0.0/14
        hostPrefix: 23
      serviceNetwork:
      - 172.30.0.0/16
      defaultNetwork:
        type: OpenShiftSDN
        openshiftSDNConfig:
          mode: NetworkPolicy
          mtu: 1450
          vxlanPort: 4789
    1
    spec パラメーターのパラメーターは例です。CR に Cluster Network Operator の設定を指定します。

    CNO は CR にパラメーターのデフォルト値を提供するため、変更が必要なパラメーターのみを指定する必要があります。

  5. cluster-network-03-config.yml ファイルを保存し、テキストエディターを終了します。
  6. オプション: manifests/cluster-network-03-config.yml ファイルをバックアップします。インストールプログラムは、クラスターの作成時に manifests/ ディレクトリーを削除します。

1.4.6. クラスターネットワーク Operator のカスタムリソース (CR、Custom Resource)

Network.operator.openshift.io カスタムリソース (CR) のクラスターネットワーク設定は、Cluster Network Operator (CNO) の設定内容を保存します。Operator はクラスターネットワークを管理します。

defaultNetwork パラメーターのパラメーターを CNO CR に設定することにより、OpenShift Container Platform クラスターのクラスターネットワーク設定を指定できます。以下の CR は、CNO のデフォルト設定を表示し、設定可能なパラメーターと有効なパラメーターの値の両方について説明しています。

Cluster Network Operator CR

apiVersion: operator.openshift.io/v1
kind: Network
metadata:
  name: cluster
spec:
  clusterNetwork: 1
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  serviceNetwork: 2
  - 172.30.0.0/16
  defaultNetwork: 3
    ...
  kubeProxyConfig: 4
    iptablesSyncPeriod: 30s 5
    proxyArguments:
      iptables-min-sync-period: 6
      - 30s

1 2
install-config.yaml ファイルに指定されます。
3
クラスターネットワークの SDN (software-defined networking) を設定します。
4
このオブジェクトのパラメーターは、kube-proxy 設定を指定します。パラメーターの値を指定しない場合 、ネットワーク Operator は表示されるデフォルトのパラメーター値を適用します。
5
iptables ルールの更新期間。デフォルト値は 30s です。有効なサフィックスには、sm、および hなどが含まれ、これらについては、Go time package ドキュメントで説明されています。
6
iptables ルールを更新する前の最小期間。このパラメーターにより、更新の頻度が高くなり過ぎないようにできます。有効なサフィックスには、sm、および h が含まれ、これらについては、Go time package で説明されています。

1.4.6.1. OpenShift SDN の設定パラメーター

以下の YAML オブジェクトは OpenShift SDN の設定パラメーターについて説明しています。

defaultNetwork:
  type: OpenShiftSDN 1
  openshiftSDNConfig: 2
    mode: NetworkPolicy 3
    mtu: 1450 4
    vxlanPort: 4789 5
1
install-config.yaml ファイルに指定されます。
2
OpenShift SDN 設定の一部を上書きする必要がある場合にのみ指定します。
3
OpenShiftSDN のネットワーク分離モードを設定します。許可される値は MultitenantSubnet、または NetworkPolicy です。デフォルト値は NetworkPolicy です。
4
VXLAN オーバーレイネットワークの MTU。この値は通常は自動的に設定されますが、クラスターにあるノードすべてが同じ MTU を使用しない場合、これを最小のノード MTU 値よりも 50 小さくする必要があります。
5
すべての VXLAN パケットに使用するポート。デフォルト値は 4789 です。別の VXLAN ネットワークの一部である既存ノードと共に仮想化環境で実行している場合は、これを変更する必要がある可能性があります。たとえば、OpenShift SDN オーバーレイを VMware NSX-T 上で実行する場合は、両方の SDN が同じデフォルトの VXLAN ポート番号を使用するため、VXLAN の別のポートを選択する必要があります。

Amazon Web Services (AWS) では、VXLAN にポート 9000 とポート 9999 間の代替ポートを選択できます。

1.4.6.2. Open Virtual Network (OVN) SDN の設定パラメーター

OVN SDN には OpenShift Container Platform 4.2 の設定パラメーターがありません。

1.4.6.3. Cluster Network Operator のサンプル CR

以下の例のように、CNO の完全な CR が表示されます。

Cluster Network Operator のサンプル CR

apiVersion: operator.openshift.io/v1
kind: Network
metadata:
  name: cluster
spec:
  clusterNetwork:
  - cidr: 10.128.0.0/14
    hostPrefix: 23
  serviceNetwork:
  - 172.30.0.0/16
  defaultNetwork:
    type: OpenShiftSDN
    openshiftSDNConfig:
      mode: NetworkPolicy
      mtu: 1450
      vxlanPort: 4789
  kubeProxyConfig:
    iptablesSyncPeriod: 30s
    proxyArguments:
      iptables-min-sync-period:
      - 30s

1.4.7. クラスターのデプロイ

互換性のあるクラウドプラットフォームに OpenShift Container Platform をインストールできます。

重要

インストールプログラムの create cluster コマンドは、初期インストール時に 1 回だけ実行できます。

前提条件

  • クラスターをホストするクラウドプラットフォームでアカウントを設定します。
  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. インストールプログラムを実行します。

    $ ./openshift-install create cluster --dir=<installation_directory> \ 1
        --log-level=info 2
    1
    <installation_directory> については、カスタマイズされた ./install-config.yaml ファイルの場所を指定します。これは、インストールプログラムが作成するファイルを保存するためのディレクトリーの名前です。
    2
    異なるインストールの詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。
    重要

    空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    プロンプト時に値を指定します。

    1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

      注記

      インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

    2. ターゲットに設定するプラットフォームとして aws を選択します。
    3. Amazon Web Services (AWS) プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
    4. クラスターのデプロイ先とする AWS リージョンを選択します。
    5. クラスターに設定した Route53 サービスのベースドメインを選択します。
    6. クラスターの記述名を入力します。
    7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
    注記

    ホストに設定した AWS アカウントにクラスターをデプロイするための十分なパーミッションがない場合、インストールプログラムは停止し、不足しているパーミッションが表示されます。

    クラスターのデプロイメントが完了すると、Web コンソールへのリンクや kubeadmin ユーザーの認証情報を含む、クラスターにアクセスするための指示がターミナルに表示されます。

    重要

    インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

    重要

    インストールプログラム、またはインストールプログラムが作成するファイルを削除することはできません。これらはいずれもクラスターを削除するために必要になります。

  2. オプション: クラスターのインストールに使用した IAM アカウントから AdministratorAccess ポリシーを削除するか、または無効にします。

1.4.8. CLI のインストール

コマンドラインインターフェースを使用して OpenShift Container Platform と対話するために CLI をインストールすることができます。

重要

以前のバージョンの oc をインストールしている場合、これを使用して OpenShift Container Platform 4.2 のすべてのコマンドを実行することはできません。新規バージョンの ocをダウンロードし、インストールします。

手順

  1. Red Hat OpenShift Cluster Manager サイトの Infrastructure Provider ページから、選択するインストールタイプのページに移動し、Download Command-line Tools をクリックします。
  2. オペレーティングシステムおよびアーキテクチャーのフォルダーをクリックしてから、圧縮されたファイルをクリックします。

    注記

    oc は Linux、Windows、または macOS にインストールできます。

  3. ファイルをファイルシステムに保存します。
  4. 圧縮ファイルを展開します。
  5. これを PATH にあるディレクトリーに配置します。

CLI のインストール後は、oc コマンドを使用して利用できます。

$ oc <command>

1.4.9. クラスターへのログイン

クラスター kubeconfig ファイルをエクスポートし、デフォルトシステムユーザーとしてクラスターにログインできます。kubeconfig ファイルには、クライアントを正しいクラスターおよび API サーバーに接続するために CLI で使用されるクラスターについての情報が含まれます。このファイルはクラスターに固有のファイルであり、OpenShift Container Platform のインストール時に作成されます。

前提条件

  • OpenShift Container Platform クラスターのデプロイ。
  • oc CLI のインストール。

手順

  1. kubeadmin 認証情報をエクスポートします。

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
  2. エクスポートされた設定を使用して、oc コマンドを正常に実行できることを確認します。

    $ oc whoami
    system:admin

次のステップ

1.5. CloudFormation テンプレートの使用による、AWS でのユーザーによってプロビジョニングされたインフラストラクチャーへのクラスターのインストール

OpenShift Container Platform バージョン 4.2 では、独自に提供するインフラストラクチャーを使用するクラスターを Amazon Web Services (AWS) にインストールできます。

このインフラストラクチャーを作成する 1 つの方法として、提供される CloudFormation テンプレートを使用できます。テンプレートを変更してインフラストラクチャーをカスタマイズしたり、それらに含まれる情報を使用し、所属する会社のポリシーに基づいて AWS オブジェクトを作成したりできます。

前提条件

  • OpenShift Container Platform のインストールおよび更新プロセスについての詳細を確認します。
  • AWS アカウントを設定してクラスターをホストします。

    重要

    AWS プロファイルがご使用のコンピューターに保存されている場合、マルチファクター認証デバイスを使用中に生成した一時的なセッショントークンを使用することはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、キーをベースとした有効期間の長い認証情報を使用する必要があります。適切なキーを生成するには、AWS ドキュメントの「Managing Access Keys for IAM Users」を参照してください。キーは、インストールプログラムの実行時に指定できます。

  • AWS CLI をダウンロードし、これをコンピューターにインストールします。AWS ドキュメントの「Install the AWS CLI Using the Bundled Installer (Linux, macOS, or Unix)」を参照してください。
  • ファイアウォールを使用する場合、クラスターがアクセスを必要とするサイトを許可するようにファイアウォールを設定する必要があります。

    注記

    プロキシーを設定する場合は、このサイト一覧も確認してください。

1.5.1. OpenShift Container Platform のインターネットアクセスおよび Telemetry アクセス

OpenShift Container Platform 4.2 では、クラスターをインストールするためにインターネットアクセスが必要になります。クラスターの健全性および正常に実行された更新についてのメトリクスを提供するためにデフォルトで実行される Telemetry サービスにもインターネットアクセスが必要です。クラスターがインターネットに接続されている場合、Telemetry は自動的に実行され、クラスターは Red Hat OpenShift Cluster Manager (OCM) に登録されます。

Red Hat OpenShift Cluster Manager インベントリーが Telemetry によって自動的に維持されるか、または OCM を手動で使用しているかのいずれによって正常であることを確認した後に、subscription watch を使用して、アカウントまたはマルチクラスターレベルで OpenShift Container Platform サブスクリプションを追跡します。

インターネットへのアクセスは以下を実行するために必要です。

  • Red Hat OpenShift Cluster Manager ページにアクセスし、インストールプログラムをダウンロードし、サブスクリプション管理を実行します。クラスターにインターネットアクセスがあり、Telemetry を無効にしない場合、そのサービスは有効なサブスクリプションでクラスターを自動的に使用します。
  • クラスターのインストールに必要なパッケージを取得するために Quay.io にアクセスします。
  • クラスターの更新を実行するために必要なパッケージを取得します。
重要

クラスターでインターネットに直接アクセスできない場合、プロビジョニングする一部のタイプのインフラストラクチャーでネットワークが制限されたインストールを実行できます。このプロセスで、必要なコンテンツをダウンロードし、これを使用してミラーレジストリーにクラスターのインストールおよびインストールプログラムの生成に必要なパッケージを設定します。 インストールタイプによっては、クラスターのインストール環境でインターネットアクセスが不要となる場合があります。クラスターを更新する前に、ミラーレジストリーのコンテンツを更新します。

1.5.2. 必要な AWS インフラストラクチャーコンポーネント

OpenShift Container Platform を Amazon Web Services (AWS) のユーザーによってプロビジョニングされるインフラストラクチャーにインストールするには、マシンとサポートするインフラストラクチャーの両方を手動で作成する必要があります。

各種プラットフォームの統合テストの詳細については、「 OpenShift Container Platform 4.x Tested Integrations」のページを参照してください。

提供される CloudFormation テンプレートを使用してこのインフラストラクチャーを作成でき、コンポーネントを手動で作成するか、またはクラスターの要件を満たす既存のインフラストラクチャーを再利用できます。コンポーネントの相互関係についての詳細は、CloudFormation テンプレートを参照してください。

1.5.2.1. クラスターマシン

以下のマシンには AWS::EC2::Instance オブジェクトが必要になります。

  • ブートストラップマシン。このマシンはインストール時に必要ですが、クラスターのデプロイ後に除去することができます。
  • 3 つ以上のコントロールプレーンマシン。コントロールプレーンマシンは MachineSet によって制御されません。
  • コンピュートマシン。インストール時に 2 つ以上のコンピュートマシン (ワーカーマシンとしても知られる) を作成する必要があります。これらのマシンは MachineSet によって制御されません。

提供される CloudFormation テンプレートを使用して、クラスターマシンの以下のインスタンスタイプを使用できます。

重要

m4 インスタンスが eu-west-3 などのリージョンで利用可能ではない場合、m5 タイプを代わりに使用します。

表1.8 マシンのインスタンスタイプ

インスタンスタイプブートストラップコントロールプレーンコンピュート

i3.large

x

  

m4.large または m5.large

  

x

m4.xlarge または m5.xlarge

 

x

x

m4.2xlarge

 

x

x

m4.4xlarge

 

x

x

m4.8xlarge

 

x

x

m4.10xlarge

 

x

x

m4.16xlarge

 

x

x

c4.large

  

x

c4.xlarge

  

x

c4.2xlarge

 

x

x

c4.4xlarge

 

x

x

c4.8xlarge

 

x

x

r4.large

  

x

r4.xlarge

 

x

x

r4.2xlarge

 

x

x

r4.4xlarge

 

x

x

r4.8xlarge

 

x

x

r4.16xlarge

 

x

x

これらのインスタンスタイプの仕様に対応する他のインスタンスタイプを使用できる場合もあります。

1.5.2.2. 証明書署名要求の管理

ユーザーがプロビジョニングするインフラストラクチャーを使用する場合、クラスターの自動マシン管理へのアクセスは制限されるため、インストール後にクラスターの証明書署名要求 (CSR) のメカニズムを提供する必要があります。kube-controller-manager は kubelet クライアント CSR のみを承認します。machine-approver は、kubelet 認証情報を使用して要求される提供証明書の有効性を保証できません。適切なマシンがこの要求を発行したかどうかを確認できないためです。kubelet 提供証明書の要求の有効性を検証し、それらを承認する方法を判別し、実装する必要があります。

1.5.2.3. 他のインフラストラクチャーコンポーネント

  • 1 つの VPC
  • DNS エントリー
  • ロードバランサー(classic または network)およびリスナー
  • パブリックおよびプライベート Route53 ゾーン
  • セキュリティーグループ
  • IAM ロール
  • S3 バケット

必要な VPC コンポーネント

お使いのマシンとの通信を可能にする適切な VPC およびサブネットを指定する必要があります。

コンポーネントAWS タイプ説明

VPC

  • AWS::EC2::VPC
  • AWS::EC2::VPCEndpoint

使用するクラスターのパブリック VPC を指定する必要があります。VPC は、各サブネットのルートテーブルを参照するエンドポイントを使用して、S3 でホストされているレジストリーとの通信を強化します。

パブリックサブネット

  • AWS::EC2::Subnet
  • AWS::EC2::SubnetNetworkAclAssociation

VPC には 1 から 3 のアベイラビリティーゾーンのパブリックサブネットが必要であり、それらを適切な Ingress ルールに関連付ける必要があります。

インターネットゲートウェイ

  • AWS::EC2::InternetGateway
  • AWS::EC2::VPCGatewayAttachment
  • AWS::EC2::RouteTable
  • AWS::EC2::Route
  • AWS::EC2::SubnetRouteTableAssociation
  • AWS::EC2::NatGateway
  • AWS::EC2::EIP

VPC に割り当てられたパブリックルートを持つパブリックインターネットゲートウェイが必要です。提供されるテンプレートでは、各パブリックサブネットに EIP アドレスと NAT ゲートウェイがあります。これらの NAT ゲートウェイは、プライベートサブネットインスタンスなどのクラスターリソースがインターネットに到達できるようにするもので、一部のネットワークが制限された環境またはプロキシーのシナリオでは必要ありません。

ネットワークアクセス制御

  • AWS::EC2::NetworkAcl
  • AWS::EC2::NetworkAclEntry

VPC が以下のポートにアクセスできるようにする必要があります。

ポート

理由

80

インバウンド HTTP トラフィック

443

インバウンド HTTPS トラフィック

22

インバウンド SSH トラフィック

1024 - 65535

インバウンド一時 (ephemeral) トラフィック

0 - 65535

アウトバウンド一時 (ephemeral) トラフィック

プライベートサブネット

  • AWS::EC2::Subnet
  • AWS::EC2::RouteTable
  • AWS::EC2::SubnetRouteTableAssociation

VPC にはプライベートサブネットを使用できます。提供される CloudFormation テンプレートは 1 から 3 アベイラビリティーゾーンのプライベートサブネットを作成できます。プライベートサブネットを使用できる場合は、それらの適切なルートおよびテーブルを指定する必要があります。

必要な DNS および負荷分散コンポーネント

DNS およびロードバランサー設定では、パブリックホストゾーンを使用する必要があり、クラスターのインフラストラクチャーをプロビジョニングする場合にインストールプログラムが使用するものと同様のプライベートホストゾーンを使用できます。ロードバランサーに解決する DNS エントリーを作成する必要があります。api.<cluster_name>.<domain> のエントリーは外部ロードバランサーを参照し、api-int.<cluster_name>.<domain> のエントリーは内部ロードバランサーを参照する必要があります。

またクラスターには、Kubernetes API とその拡張に必要なポート 6443、および新規マシンの Ignition 設定ファイルに必要なポート 22623 のロードバランサーおよびリスナーが必要です。ターゲットはマスターノードになります。ポート 6443 はクラスター外のクライアントとクラスター内のノードからもアクセスできる必要があります。ポート 22623 はクラスター内のノードからアクセスできる必要があります。

コンポーネントAWS タイプ説明

DNS

AWS::Route53::HostedZone

内部 DNS のホストゾーン。

etcd レコードセット

AWS::Route53::RecordSet

コントロールプレーンマシンの etcd の登録レコード。

パブリックロードバランサー

AWS::ElasticLoadBalancingV2::LoadBalancer

パブリックサブネットのロードバランサー。

外部 API サーバーレコード

AWS::Route53::RecordSetGroup

外部 API サーバーのエイリアスレコード。

外部リスナー

AWS::ElasticLoadBalancingV2::Listener

外部ロードバランサー用のポート 6443 のリスナー。

外部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

外部ロードバランサーのターゲットグループ。

プライベートロードバランサー

AWS::ElasticLoadBalancingV2::LoadBalancer

プライベートサブネットのロードバランサー。

内部 API サーバーレコード

AWS::Route53::RecordSetGroup

内部 API サーバーのエイリアスレコード。

内部リスナー

AWS::ElasticLoadBalancingV2::Listener

内部ロードバランサー用のポート 22623 のリスナー。

内部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

内部ロードバランサーのターゲットグループ。

内部リスナー

AWS::ElasticLoadBalancingV2::Listener

内部ロードバランサーのポート 6443 のリスナー。

内部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

内部ロードバランサーのターゲットグループ。

セキュリティーグループ

コントロールプレーンおよびワーカーマシンには、以下のポートへのアクセスが必要です。

グループタイプIP プロトコルポート範囲

MasterSecurityGroup

AWS::EC2::SecurityGroup

icmp

0

tcp

22

tcp

6443

tcp

22623

WorkerSecurityGroup

AWS::EC2::SecurityGroup

icmp

0

tcp

22

BootstrapSecurityGroup

AWS::EC2::SecurityGroup

tcp

22

tcp

19531

コントロールプレーンの Ingress

コントロールプレーンマシンには、以下の Ingress グループが必要です。それぞれの Ingress グループは AWS::EC2::SecurityGroupIngress リソースになります。

Ingress グループ説明IP プロトコルポート範囲

MasterIngressEtcd

etcd

tcp

2379- 2380

MasterIngressVxlan

Vxlan パケット

udp

4789

MasterIngressWorkerVxlan

Vxlan パケット

udp

4789

MasterIngressInternal

内部クラスター通信および Kubernetes プロキシーメトリクス

tcp

9000 - 9999

MasterIngressWorkerInternal

内部クラスター通信

tcp

9000 - 9999

MasterIngressKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250 - 10259

MasterIngressWorkerKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250 - 10259

MasterIngressIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

MasterIngressWorkerIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

ワーカーの Ingress

ワーカーマシンには、以下の Ingress グループが必要です。それぞれの Ingress グループは AWS::EC2::SecurityGroupIngress リソースになります。

Ingress グループ説明IP プロトコルポート範囲

WorkerIngressVxlan

Vxlan パケット

udp

4789

WorkerIngressWorkerVxlan

Vxlan パケット

udp

4789

WorkerIngressInternal

内部クラスター通信

tcp

9000 - 9999

WorkerIngressWorkerInternal

内部クラスター通信

tcp

9000 - 9999

WorkerIngressKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250

WorkerIngressWorkerKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250

WorkerIngressIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

WorkerIngressWorkerIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

ロールおよびインスタンスプロファイル

マシンには、AWS でのパーミッションを付与する必要があります。提供される CloudFormation テンプレートはマシンに対し、以下の AWS::IAM::Role オブジェクトについてのパーミッションを付与し、それぞれのロールセットに AWS::IAM::InstanceProfile を指定します。テンプレートを使用しない場合、マシンには以下の広範囲のパーミッションまたは個別のパーミッションを付与することができます。

ロール結果アクションリソース

マスター

Allow

ec2:*

*

Allow

elasticloadbalancing:*

*

Allow

iam:PassRole

*

Allow

s3:GetObject

*

ワーカー

Allow

ec2:Describe*

*

ブートストラップ

Allow

ec2:Describe*

*

Allow

ec2:AttachVolume

*

Allow

ec2:DetachVolume

*

1.5.2.4. 必要な AWS パーミッション

AdministratorAccess ポリシーを、作成する IAM ユーザーに割り当てる場合、そのユーザーには必要なパーミッションすべてを付与します。OpenShift Container Platform クラスターをデプロイするために、IAM ユーザーに以下のパーミッションが必要になります。

インストールに必要な EC2 パーミッション

  • ec2:AllocateAddress
  • ec2:AssociateAddress
  • ec2:AssociateDhcpOptions
  • ec2:AssociateRouteTable
  • ec2:AttachInternetGateway
  • ec2:AuthorizeSecurityGroupEgress
  • ec2:AuthorizeSecurityGroupIngress
  • ec2:CopyImage
  • ec2:CreateDhcpOptions
  • ec2:CreateInternetGateway
  • ec2:CreateNatGateway
  • ec2:CreateNetworkInterface
  • ec2:CreateRoute
  • ec2:CreateRouteTable
  • ec2:CreateSecurityGroup
  • ec2:CreateSubnet
  • ec2:CreateTags
  • ec2:CreateVpc
  • ec2:CreateVpcEndpoint
  • ec2:CreateVolume
  • ec2:DeleteSnapshot
  • ec2:DeregisterImage
  • ec2:DescribeAccountAttributes
  • ec2:DescribeAddresses
  • ec2:DescribeAvailabilityZones
  • ec2:DescribeDhcpOptions
  • ec2:DescribeImages
  • ec2:DescribeInstanceAttribute
  • ec2:DescribeInstanceCreditSpecifications
  • ec2:DescribeInstances
  • ec2:DescribeInternetGateways
  • ec2:DescribeKeyPairs
  • ec2:DescribeNatGateways
  • ec2:DescribeNetworkAcls
  • ec2:DescribePrefixLists
  • ec2:DescribeRegions
  • ec2:DescribeRouteTables
  • ec2:DescribeSecurityGroups
  • ec2:DescribeSubnets
  • ec2:DescribeTags
  • ec2:DescribeVpcEndpoints
  • ec2:DescribeVpcs
  • ec2:DescribeVpcAttribute
  • ec2:DescribeVolumes
  • ec2:DescribeVpcClassicLink
  • ec2:DescribeVpcClassicLinkDnsSupport
  • ec2:ModifyInstanceAttribute
  • ec2:ModifySubnetAttribute
  • ec2:ModifyVpcAttribute
  • ec2:RevokeSecurityGroupEgress
  • ec2:RunInstances
  • ec2:TerminateInstances
  • ec2:DeleteDhcpOptions
  • ec2:DeleteRoute
  • ec2:RevokeSecurityGroupIngress
  • ec2:DisassociateRouteTable
  • ec2:ReplaceRouteTableAssociation
  • ec2:DeleteRouteTable
  • ec2:DeleteSubnet
  • ec2:DescribeNetworkInterfaces
  • ec2:ModifyNetworkInterfaceAttribute
  • ec2:DeleteNatGateway
  • ec2:DeleteSecurityGroup
  • ec2:DetachInternetGateway
  • ec2:DeleteInternetGateway
  • ec2:ReleaseAddress
  • ec2:DeleteVpc

インストールに必要な Elasticloadbalancing パーミッション

  • elasticloadbalancing:AddTags
  • elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
  • elasticloadbalancing:AttachLoadBalancerToSubnets
  • elasticloadbalancing:CreateListener
  • elasticloadbalancing:CreateLoadBalancer
  • elasticloadbalancing:CreateLoadBalancerListeners
  • elasticloadbalancing:CreateTargetGroup
  • elasticloadbalancing:ConfigureHealthCheck
  • elasticloadbalancing:DeleteLoadBalancer
  • elasticloadbalancing:DeregisterInstancesFromLoadBalancer
  • elasticloadbalancing:DeregisterTargets
  • elasticloadbalancing:DescribeInstanceHealth
  • elasticloadbalancing:DescribeListeners
  • elasticloadbalancing:DescribeLoadBalancers
  • elasticloadbalancing:DescribeLoadBalancerAttributes
  • elasticloadbalancing:DescribeTags
  • elasticloadbalancing:DescribeTargetGroupAttributes
  • elasticloadbalancing:DescribeTargetHealth
  • elasticloadbalancing:ModifyLoadBalancerAttributes
  • elasticloadbalancing:ModifyTargetGroup
  • elasticloadbalancing:ModifyTargetGroupAttributes
  • elasticloadbalancing:RegisterTargets
  • elasticloadbalancing:RegisterInstancesWithLoadBalancer
  • elasticloadbalancing:SetLoadBalancerPoliciesOfListener

インストールに必要な IAM パーミッション

  • iam:AddRoleToInstanceProfile
  • iam:CreateInstanceProfile
  • iam:CreateRole
  • iam:DeleteInstanceProfile
  • iam:DeleteRole
  • iam:DeleteRolePolicy
  • iam:GetInstanceProfile
  • iam:GetRole
  • iam:GetRolePolicy
  • iam:GetUser
  • iam:ListInstanceProfilesForRole
  • iam:ListRoles
  • iam:ListUsers
  • iam:PassRole
  • iam:PutRolePolicy
  • iam:RemoveRoleFromInstanceProfile
  • iam:SimulatePrincipalPolicy
  • iam:TagRole

インストールに必要な Route53 パーミッション

  • route53:ChangeResourceRecordSets
  • route53:ChangeTagsForResource
  • route53:GetChange
  • route53:GetHostedZone
  • route53:CreateHostedZone
  • route53:DeleteHostedZone
  • route53:ListHostedZones
  • route53:ListHostedZonesByName
  • route53:ListResourceRecordSets
  • route53:ListTagsForResource
  • route53:UpdateHostedZoneComment

インストールに必要な S3 パーミッション

  • s3:CreateBucket
  • s3:DeleteBucket
  • s3:GetAccelerateConfiguration
  • s3:GetBucketCors
  • s3:GetBucketLocation
  • s3:GetBucketLogging
  • s3:GetBucketObjectLockConfiguration
  • s3:GetBucketReplication
  • s3:GetBucketRequestPayment
  • s3:GetBucketTagging
  • s3:GetBucketVersioning
  • s3:GetBucketWebsite
  • s3:GetEncryptionConfiguration
  • s3:GetLifecycleConfiguration
  • s3:GetReplicationConfiguration
  • s3:ListBucket
  • s3:PutBucketAcl
  • s3:PutBucketTagging
  • s3:PutEncryptionConfiguration

クラスター Operator が必要とする S3 パーミッション

  • s3:PutObject
  • s3:PutObjectAcl
  • s3:PutObjectTagging
  • s3:GetObject
  • s3:GetObjectAcl
  • s3:GetObjectTagging
  • s3:GetObjectVersion
  • s3:DeleteObject

クラスターのアンインストールに必要な追加のすべてのパーミッション

  • autoscaling:DescribeAutoScalingGroups
  • ec2:DeleteNetworkInterface
  • ec2:DeleteVolume
  • ec2:DeleteVpcEndpoints
  • elasticloadbalancing:DescribeTargetGroups
  • elasticloadbalancing:DeleteTargetGroup
  • iam:ListInstanceProfiles
  • iam:ListRolePolicies
  • iam:ListUserPolicies
  • tag:GetResources

マニフェストの作成に必要な追加の IAM および S3 パーミッション

  • iam:CreateAccessKey
  • iam:CreateUser
  • iam:DeleteAccessKey
  • iam:DeleteUser
  • iam:DeleteUserPolicy
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • iam:PutUserPolicy
  • iam:TagUser
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • s3:PutBucketPublicAccessBlock
  • s3:GetBucketPublicAccessBlock
  • s3:PutLifecycleConfiguration
  • s3:HeadBucket
  • s3:ListBucketMultipartUploads
  • s3:AbortMultipartUpload

1.5.3. インストールプログラムの取得

OpenShift Container Platform をインストールする前に、インストールファイルを

ローカルコンピューターにダウンロードします。

前提条件

  • Linux または macOS を使用するコンピューターからクラスターをインストールする必要があります。
  • インストールプログラムをダウンロードするには、500 MB のローカルディスク領域が必要です。

手順

  1. Red Hat OpenShift Cluster Manager サイトの「Infrastructure Provider」ページにアクセスします。Red Hat アカウントがある場合は、認証情報を使ってログインします。アカウントがない場合はこれを作成します。
  2. 選択するインストールタイプのページに移動し、オペレーティングシステムのインストールプログラムをダウンロードし、ファイルをインストール設定ファイルを保存するディレクトリーに配置します。

    重要

    インストールプログラムは、クラスターのインストールに使用するコンピューターにいくつかのファイルを作成します。クラスターインストールの完了後は、インストールプログラムおよびインストールプログラムが作成するファイルの両方を保持する必要があります。

  3. インストールプログラムを展開します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ tar xvf <installation_program>.tar.gz
  4. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから、インストールプルシークレットを .txt ファイルとしてダウンロードします。このプルシークレットを使用し、OpenShift Container Platform コンポーネントのコンテナーイメージを提供する、Quay.io などの組み込まれた各種の認証局によって提供されるサービスで認証できます。

1.5.4. SSH プライベートキーの生成およびエージェントへの追加

クラスターでインストールのデバッグまたは障害復旧を実行する必要がある場合、ssh-agent とインストールプログラムの両方に SSH キーを指定する必要があります。

注記

実稼働環境では、障害復旧およびデバッグが必要です。

このキーを使用して、ユーザー core としてマスターノードに対して SSH を実行できます。クラスターをデプロイする際に、キーは core ユーザーの ~/.ssh/authorized_keys 一覧に追加されます。

注記

AWS キーペアなどのプラットフォームに固有の方法で設定したキーではなく、ローカルキーを使用する必要があります。

手順

  1. パスワードなしの認証に設定されている SSH キーがコンピューター上にない場合は、これを作成します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ ssh-keygen -t rsa -b 4096 -N '' \
        -f <path>/<file_name> 1
    1
    ~/.ssh/id_rsa などの、SSH キーのパスおよびファイル名を指定します。

    このコマンドを実行すると、指定した場所にパスワードを必要としない SSH キーが生成されます。

  2. ssh-agent プロセスをバックグラウンドタスクとして開始します。

    $ eval "$(ssh-agent -s)"
    
    Agent pid 31874
  3. SSH プライベートキーを ssh-agent に追加します。

    $ ssh-add <path>/<file_name> 1
    
    Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
    1
    ~/.ssh/id_rsa などの、SSH プライベートキーのパスおよびファイル名を指定します。

次のステップ

  • OpenShift Container Platform をインストールする際に、SSH パブリックキーをインストールプログラムに指定します。クラスターを独自にプロビジョニングするインフラストラクチャーにインストールする場合は、このキーをクラスターのマシンに指定する必要があります。

1.5.5. AWS のインストール設定ファイルの作成

ユーザーによってプロビジョニングされるインフラストラクチャー を使用して OpenShift Container Platform を Amazon Web Services (AWS) にインストールするには、インストールプログラムがクラスターをデプロイするために必要なファイルを生成し、クラスターが使用するマシンのみを作成するようにそれらのファイルを変更する必要があります。install-config.yaml ファイル、Kubernetes マニフェスト、および Ignition 設定ファイルを生成し、カスタマイズします。

1.5.5.1. インストール設定ファイルの作成

インストールプログラムがクラスターをデプロイするために必要なインストール設定ファイルを生成し、カスタマイズします。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。

手順

  1. install-config.yaml ファイルを取得します。

    1. 次のコマンドを実行します。

      $ ./openshift-install create install-config --dir=<installation_directory> 1
      1
      <installation_directory> には、インストールプログラムが作成するファイルを保存するためにディレクトリー名を指定します。
      重要

      空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    2. プロンプト時に、クラウドの設定の詳細情報を指定します。

      1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

        注記

        インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

      2. ターゲットに設定するプラットフォームとして aws を選択します。
      3. AWS プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
      4. クラスターのデプロイ先とする AWS リージョンを選択します。
      5. クラスターに設定した Route53 サービスのベースドメインを選択します。
      6. クラスターの記述名を入力します。
      7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
  2. install-config.yaml ファイルを編集し、以下の compute スタンザに示されるようにコンピュートレプリカ (ワーカーレプリカとしても知られる) の数を 0 に設定します。

    compute:
    - hyperthreading: Enabled
      name: worker
      platform: {}
      replicas: 0
  3. オプション: install-config.yaml ファイルをバックアップします。

    重要

    install-config.yaml ファイルはインストールプロセス時に使用されます。このファイルを再利用する必要がある場合は、この段階でこれをバックアップしてください。

1.5.5.2. インストール時のクラスター全体のプロキシーの設定

実稼働環境では、インターネットへの直接アクセスを拒否し、代わりに HTTP または HTTPS プロキシーを使用することができます。プロキシー設定を install-config.yaml ファイルで行うことにより、新規の OpenShift Container Platform クラスターをプロキシーを使用するように設定できます。

前提条件

  • 既存の install-config.yaml ファイル。
  • クラスターがアクセスする必要のあるサイトを確認し、プロキシーをバイパスする必要があるかどうかを判別する。デフォルトで、すべてのクラスター egress トラフィック (クラスターをホストするクラウドについてのクラウドプロバイダー API に対する呼び出しを含む) はプロキシーされます。プロキシーオブジェクトの spec.noProxy フィールドにサイトを追加し、必要に応じてプロキシーをバイパスします。

    注記

    プロキシーオブジェクトの status.noProxy フィールドは、デフォルトでインスタンスメタデータエンドポイント (169.254.169.254) およびインストール設定の networking.machineCIDRnetworking.clusterNetwork.cidr、および networking.serviceNetwork フィールドの値で設定されます。

手順

  1. install-config.yaml ファイルを編集し、プロキシー設定を追加します。以下は例になります。

    apiVersion: v1
    baseDomain: my.domain.com
    proxy:
      httpProxy: http://<username>:<pswd>@<ip>:<port> 1
      httpsProxy: http://<username>:<pswd>@<ip>:<port> 2
      noProxy: example.com 3
    additionalTrustBundle: | 4
        -----BEGIN CERTIFICATE-----
        <MY_TRUSTED_CA_CERT>
        -----END CERTIFICATE-----
    ...
    1
    クラスター外の HTTP 接続を作成するために使用するプロキシー URL。URL スキームは httpである必要があります。
    2
    クラスター外で HTTPS 接続を作成するために使用するプロキシー URL。このフィールドが指定されていない場合、HTTP および HTTPS 接続の両方に httpProxy が使用されます。URL スキームは http である必要があります。 https は現在サポートされていません。
    3
    プロキシーを除外するための宛先ドメイン名、ドメイン、IP アドレス、または他のネットワーク CIDR のカンマ区切りの一覧。ドメインのすべてのサブドメインを組み込むために、ドメインの前に . を入力します。* を使用し、すべての宛先のプロキシーをバイパスします。
    4
    指定されている場合、インストールプログラムは HTTPS 接続のプロキシーに必要な 1 つ以上の追加の CA 証明書が含まれる user-ca-bundle という名前の ConfigMap を openshift-config namespace に生成します。次に、Cluster Network Operator は 3 つのコンテンツを Red Hat Enterprise Linux CoreOS (RHCOS) 信頼バンドルにマージする trusted-ca-bundle ConfigMap を作成し、この ConfigMap はプロキシーオブジェクトの trustedCA フィールドで参照されます。additionalTrustBundle フィールドは、プロキシーのアイデンティティー証明書が RHCOS 信頼バンドルからの認証局によって署名されない限り必要になります。
    注記

    インストールプログラムは、プロキシーの readinessEndpoints フィールドをサポートしません。

  2. ファイルを保存し、OpenShift Container Platform のインストール時にこれを参照します。

インストールプログラムは、指定の install-config.yaml ファイルのプロキシー設定を使用する cluster という名前のクラスター全体のプロキシーを作成します。プロキシー設定が指定されていない場合、 cluster のプロキシーオブジェクトが依然として作成されますが、これには spec がありません。

注記

cluster という名前のプロキシーオブジェクトのみがサポートされ、追加のプロキシーを作成することはできません。

1.5.5.3. Kubernetes マニフェストおよび Ignition 設定ファイルの作成

一部のクラスター定義ファイルを変更し、クラスターマシンを手動で起動する必要があるため、クラスターがマシンを作成するために必要な Kubernetes マニフェストと Ignition 設定ファイルを生成する必要があります。

重要

インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターのインストールを完了し、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

前提条件

  • OpenShift Container Platform インストールプログラムを取得します。
  • install-config.yaml インストール設定ファイルを作成します。

手順

  1. クラスターの Kubernetes マニフェストを生成します。

    $ ./openshift-install create manifests --dir=<installation_directory> 1
    
    WARNING There are no compute nodes specified. The cluster will not fully initialize without compute nodes.
    INFO Consuming "Install Config" from target directory
    1
    <installation_directory> については、作成した install-config.yaml ファイルが含まれるインストールディレクトリーを指定します。

    インストールプロセスの後の部分で独自のコンピュートマシンを作成するため、この警告を無視しても問題がありません。

  2. コントロールプレーンマシンを定義する Kubernetes マニフェストファイルを削除します。

    $ rm -f openshift/99_openshift-cluster-api_master-machines-*.yaml

    これらのファイルを削除することで、クラスターがコントロールプレーンマシンを自動的に生成するのを防ぐことができます。

  3. ワーカーマシンを定義する Kubernetes マニフェストファイルを削除します。

    $ rm -f openshift/99_openshift-cluster-api_worker-machineset-*.yaml

    ワーカーマシンは独自に作成し、管理するため、これらのマシンを初期化する必要はありません。

  4. manifests/cluster-scheduler-02-config.yml Kubernetes マニフェストファイルを変更し、Pod がコントロールプレーンマシンにスケジュールされないようにします。

    1. manifests/cluster-scheduler-02-config.yml ファイルを開きます。
    2. mastersSchedulable パラメーターを見つけ、その値を False に設定します。
    3. ファイルを保存し、終了します。
    注記

    現時点では、Kubernetes の制限により、コントロールプレーンマシンで実行されるルーター Pod に Ingress ロードバランサーがアクセスすることができません。この手順は、OpenShift Container Platform の今後のマイナーバージョンで不要になる可能性があります。

  5. オプション: Ingress Operator を DNS レコードを作成するよう設定する必要がない場合は、manifests/cluster-dns-02-config.yml DNS 設定ファイルから privateZone および publicZone セクションを削除します。

    apiVersion: config.openshift.io/v1
    kind: DNS
    metadata:
      creationTimestamp: null
      name: cluster
    spec:
      baseDomain: example.openshift.com
      privateZone: 1
        id: mycluster-100419-private-zone
      publicZone: 2
        id: example.openshift.com
    status: {}
    1 2
    これらのセクションを完全に削除します。

    これを実行する場合、後のステップで Ingress DNS レコードを手動で追加する必要があります。

  6. Ignition 設定ファイルを取得します。

    $ ./openshift-install create ignition-configs --dir=<installation_directory> 1
    1
    <installation_directory> については、同じインストールディレクトリーを指定します。

    以下のファイルはディレクトリーに生成されます。

    .
    ├── auth
    │   ├── kubeadmin-password
    │   └── kubeconfig
    ├── bootstrap.ign
    ├── master.ign
    ├── metadata.json
    └── worker.ign

1.5.6. インフラストラクチャー名の抽出

Ignition 設定には、Amazon Web Services (AWS) でクラスターを一意に識別するために使用できる一意のクラスター ID が含まれます。提供される CloudFormation テンプレートにはこのインフラストラクチャー名の参照が含まれるため、これを抽出する必要があります。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。
  • クラスターの Ignition 設定ファイルを生成します。
  • jq パッケージのインストール。

手順

  • Ignition 設定ファイルメタデータからインフラストラクチャー名を抽出し、表示するには、以下のコマンドを実行します。

    $ jq -r .infraID /<installation_directory>/metadata.json 1
    openshift-vw9j6 2
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    2
    このコマンドの出力はクラスター名とランダムな文字列になります。

1.5.7. AWS での VPC の作成

OpenShift Container Platform クラスターで使用する VPC を Amazon Web Services (AWS) で作成する必要があります。VPN およびルートテーブルを含む、各種要件を満たすように VPC をカスタマイズできます。VPC を作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "VpcCidr", 1
        "ParameterValue": "10.0.0.0/16" 2
      },
      {
        "ParameterKey": "AvailabilityZoneCount", 3
        "ParameterValue": "1" 4
      },
      {
        "ParameterKey": "SubnetBits", 5
        "ParameterValue": "12" 6
      }
    ]
    1
    VPC の CIDR ブロック。
    2
    x.x.x.x/16-24 形式で CIDR ブロックを指定します。
    3
    VPC をデプロイするアベイラビリティーゾーンの数。
    4
    1 から 3 の間の整数を指定します。
    5
    各アベイラビリティーゾーン内の各サブネットのサイズ。
    6
    5 から 13 の間の整数を指定します。 ここで、5/27 であり、 13/19 です。
  2. このトピックの「VPC の CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要な VPC について記述しています。
  3. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
    1
    <name>cluster-vpc などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  4. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    VpcId

    VPC の ID。

    PublicSubnetIds

    新規パブリックサブネットの ID。

    PrivateSubnetIds

    新規プライベートサブネットの ID。

1.5.7.1. VPC の CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要な VPC をデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for Best Practice VPC with 1-3 AZs

Parameters:
  VpcCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    Default: 10.0.0.0/16
    Description: CIDR block for VPC.
    Type: String
  AvailabilityZoneCount:
    ConstraintDescription: "The number of availability zones. (Min: 1, Max: 3)"
    MinValue: 1
    MaxValue: 3
    Default: 1
    Description: "How many AZs to create VPC subnets for. (Min: 1, Max: 3)"
    Type: Number
  SubnetBits:
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/19-27.
    MinValue: 5
    MaxValue: 13
    Default: 12
    Description: "Size of each subnet to create within the availability zones. (Min: 5 = /27, Max: 13 = /19)"
    Type: Number

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcCidr
      - SubnetBits
    - Label:
        default: "Availability Zones"
      Parameters:
      - AvailabilityZoneCount
    ParameterLabels:
      AvailabilityZoneCount:
        default: "Availability Zone Count"
      VpcCidr:
        default: "VPC CIDR"
      SubnetBits:
        default: "Bits Per Subnet"

Conditions:
  DoAz3: !Equals [3, !Ref AvailabilityZoneCount]
  DoAz2: !Or [!Equals [2, !Ref AvailabilityZoneCount], Condition: DoAz3]

Resources:
  VPC:
    Type: "AWS::EC2::VPC"
    Properties:
      EnableDnsSupport: "true"
      EnableDnsHostnames: "true"
      CidrBlock: !Ref VpcCidr
  PublicSubnet:
    Type: "AWS::EC2::Subnet"
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [0, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 0
      - Fn::GetAZs: !Ref "AWS::Region"
  PublicSubnet2:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [1, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 1
      - Fn::GetAZs: !Ref "AWS::Region"
  PublicSubnet3:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [2, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 2
      - Fn::GetAZs: !Ref "AWS::Region"
  InternetGateway:
    Type: "AWS::EC2::InternetGateway"
  GatewayToInternet:
    Type: "AWS::EC2::VPCGatewayAttachment"
    Properties:
      VpcId: !Ref VPC
      InternetGatewayId: !Ref InternetGateway
  PublicRouteTable:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
  PublicRoute:
    Type: "AWS::EC2::Route"
    DependsOn: GatewayToInternet
    Properties:
      RouteTableId: !Ref PublicRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId: !Ref InternetGateway
  PublicSubnetRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet
      RouteTableId: !Ref PublicRouteTable
  PublicSubnetRouteTableAssociation2:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz2
    Properties:
      SubnetId: !Ref PublicSubnet2
      RouteTableId: !Ref PublicRouteTable
  PublicSubnetRouteTableAssociation3:
    Condition: DoAz3
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet3
      RouteTableId: !Ref PublicRouteTable
  PrivateSubnet:
    Type: "AWS::EC2::Subnet"
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [3, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 0
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PrivateSubnet
      RouteTableId: !Ref PrivateRouteTable
  NAT:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP
        - AllocationId
      SubnetId: !Ref PublicSubnet
  EIP:
    Type: "AWS::EC2::EIP"
    Properties:
      Domain: vpc
  Route:
    Type: "AWS::EC2::Route"
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT
  PrivateSubnet2:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [4, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 1
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable2:
    Type: "AWS::EC2::RouteTable"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation2:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz2
    Properties:
      SubnetId: !Ref PrivateSubnet2
      RouteTableId: !Ref PrivateRouteTable2
  NAT2:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Condition: DoAz2
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP2
        - AllocationId
      SubnetId: !Ref PublicSubnet2
  EIP2:
    Type: "AWS::EC2::EIP"
    Condition: DoAz2
    Properties:
      Domain: vpc
  Route2:
    Type: "AWS::EC2::Route"
    Condition: DoAz2
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable2
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT2
  PrivateSubnet3:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [5, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 2
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable3:
    Type: "AWS::EC2::RouteTable"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation3:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz3
    Properties:
      SubnetId: !Ref PrivateSubnet3
      RouteTableId: !Ref PrivateRouteTable3
  NAT3:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Condition: DoAz3
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP3
        - AllocationId
      SubnetId: !Ref PublicSubnet3
  EIP3:
    Type: "AWS::EC2::EIP"
    Condition: DoAz3
    Properties:
      Domain: vpc
  Route3:
    Type: "AWS::EC2::Route"
    Condition: DoAz3
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable3
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT3
  S3Endpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      PolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal: '*'
          Action:
          - '*'
          Resource:
          - '*'
      RouteTableIds:
      - !Ref PublicRouteTable
      - !Ref PrivateRouteTable
      - !If [DoAz2, !Ref PrivateRouteTable2, !Ref "AWS::NoValue"]
      - !If [DoAz3, !Ref PrivateRouteTable3, !Ref "AWS::NoValue"]
      ServiceName: !Join
      - ''
      - - com.amazonaws.
        - !Ref 'AWS::Region'
        - .s3
      VpcId: !Ref VPC

Outputs:
  VpcId:
    Description: ID of the new VPC.
    Value: !Ref VPC
  PublicSubnetIds:
    Description: Subnet IDs of the public subnets.
    Value:
      !Join [
        ",",
        [!Ref PublicSubnet, !If [DoAz2, !Ref PublicSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PublicSubnet3, !Ref "AWS::NoValue"]]
      ]
  PrivateSubnetIds:
    Description: Subnet IDs of the private subnets.
    Value:
      !Join [
        ",",
        [!Ref PrivateSubnet, !If [DoAz2, !Ref PrivateSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PrivateSubnet3, !Ref "AWS::NoValue"]]
      ]

1.5.8. AWS でのネットワークおよび負荷分散コンポーネントの作成

OpenShift Container Platform クラスターで使用するネットワークおよび負荷分散 (classic または network) を Amazon Web Services (AWS) で設定する必要があります。これらのコンポーネントを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。 これにより、ホストゾーンおよびサブネットのタグも作成されます。

単一 VPC 内でテンプレートを複数回実行することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。

手順

  1. クラスターの install-config.yaml ファイルに指定した Route53 ゾーンのホストゾーン ID を取得します。この ID は、AWS コンソールから、または以下のコマンドを実行して取得できます。

    重要

    単一行にコマンドを入力してください。

    $ aws route53 list-hosted-zones-by-name |
         jq --arg name "<route53_domain>." \ 1
         -r '.HostedZones | .[] | select(.Name=="\($name)") | .Id'
    1
    <route53_domain> について、クラスターの install-config.yaml ファイルを生成した時に作成した Route53 ベースドメインを指定します。
  2. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "ClusterName", 1
        "ParameterValue": "mycluster" 2
      },
      {
        "ParameterKey": "InfrastructureName", 3
        "ParameterValue": "mycluster-<random_string>" 4
      },
      {
        "ParameterKey": "HostedZoneId", 5
        "ParameterValue": "<random_string>" 6
      },
      {
        "ParameterKey": "HostedZoneName", 7
        "ParameterValue": "example.com" 8
      },
      {
        "ParameterKey": "PublicSubnets", 9
        "ParameterValue": "subnet-<random_string>" 10
      },
      {
        "ParameterKey": "PrivateSubnets", 11
        "ParameterValue": "subnet-<random_string>" 12
      },
      {
        "ParameterKey": "VpcId", 13
        "ParameterValue": "vpc-<random_string>" 14
      }
    ]
    1
    ホスト名などに使用するクラスターを表す短いクラスターの名前。
    2
    クラスターの install-config.yaml ファイルを生成した時に使用したクラスター名を指定します。
    3
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    4
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    5
    ターゲットの登録に使用する Route53 パブリックトゾーン ID。
    6
    Z21IXYZABCZ2A4 に類する形式の Route53 パブリックゾーン ID を指定します。この値は AWS コンソールから取得できます。
    7
    ターゲットの登録に使用する Route53 ゾーン。
    8
    クラスターの install-config.yaml ファイルを生成した時に使用した Route53 ベースドメインを指定します。AWS コンソールに表示される末尾のピリド (.) は含めないでください。
    9
    VPC 用に作成したパブリックサブネット。
    10
    VPC の CloudFormation テンプレートの出力から PublicSubnetIds 値を指定します。
    11
    VPC 用に作成したプライベートサブネット。
    12
    VPC の CloudFormation テンプレートの出力から PrivateSubnetIds 値を指定します。
    13
    クラスター用に作成した VPC。
    14
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
  3. このトピックの「ネットワークおよびロードバランサーの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なネットワークおよび負荷分散オブジェクトについて記述しています。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-dns などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    PrivateHostedZoneId

    プライベート DNS のホストゾーン ID。

    ExternalApiLoadBalancerName

    外部 API ロードバランサーのフルネーム。

    InternalApiLoadBalancerName

    内部 API ロードバランサーのフルネーム。

    ApiServerDnsName

    API サーバーの完全ホスト名。

    RegisterNlbIpTargetsLambda

    これらのロードバランサーの登録/登録解除に役立つ Lambda ARN。

    ExternalApiTargetGroupArn

    外部 API ターゲットグループの ARN。

    InternalApiTargetGroupArn

    内部 API ターゲットグループの ARN。

    InternalServiceTargetGroupArn

    内部サービスターゲットグループの ARN。

1.5.8.1. ネットワークおよびロードバランサーの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なネットワークオブジェクトおよびロードバランサーをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Network Elements (Route53 & LBs)

Parameters:
  ClusterName:
    AllowedPattern: ^([a-zA-Z][a-zA-Z0-9\-]{0,26})$
    MaxLength: 27
    MinLength: 1
    ConstraintDescription: Cluster name must be alphanumeric, start with a letter, and have a maximum of 27 characters.
    Description: A short, representative cluster name to use for host names and other identifying names.
    Type: String
  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 cloud resources and identify items owned or used by the cluster.
    Type: String
  HostedZoneId:
    Description: The Route53 public zone ID to register the targets with, such as Z21IXYZABCZ2A4.
    Type: String
  HostedZoneName:
    Description: The Route53 zone to register the targets with, such as example.com. Omit the trailing period.
    Type: String
    Default: "example.com"
  PublicSubnets:
    Description: The internet-facing subnets.
    Type: List<AWS::EC2::Subnet::Id>
  PrivateSubnets:
    Description: The internal subnets.
    Type: List<AWS::EC2::Subnet::Id>
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - ClusterName
      - InfrastructureName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - PublicSubnets
      - PrivateSubnets
    - Label:
        default: "DNS"
      Parameters:
      - HostedZoneName
      - HostedZoneId
    ParameterLabels:
      ClusterName:
        default: "Cluster Name"
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      PublicSubnets:
        default: "Public Subnets"
      PrivateSubnets:
        default: "Private Subnets"
      HostedZoneName:
        default: "Public Hosted Zone Name"
      HostedZoneId:
        default: "Public Hosted Zone ID"

Resources:
  ExtApiElb:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: !Join ["-", [!Ref InfrastructureName, "ext"]]
      IpAddressType: ipv4
      Subnets: !Ref PublicSubnets
      Type: network

  IntApiElb:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: !Join ["-", [!Ref InfrastructureName, "int"]]
      Scheme: internal
      IpAddressType: ipv4
      Subnets: !Ref PrivateSubnets
      Type: network

  IntDns:
    Type: "AWS::Route53::HostedZone"
    Properties:
      HostedZoneConfig:
        Comment: "Managed by CloudFormation"
      Name: !Join [".", [!Ref ClusterName, !Ref HostedZoneName]]
      HostedZoneTags:
      - Key: Name
        Value: !Join ["-", [!Ref InfrastructureName, "int"]]
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "owned"
      VPCs:
      - VPCId: !Ref VpcId
        VPCRegion: !Ref "AWS::Region"

  ExternalApiServerRecord:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      Comment: Alias record for the API server
      HostedZoneId: !Ref HostedZoneId
      RecordSets:
      - Name:
          !Join [
            ".",
            ["api", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt ExtApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt ExtApiElb.DNSName

  InternalApiServerRecord:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      Comment: Alias record for the API server
      HostedZoneId: !Ref IntDns
      RecordSets:
      - Name:
          !Join [
            ".",
            ["api", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt IntApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt IntApiElb.DNSName
      - Name:
          !Join [
            ".",
            ["api-int", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt IntApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt IntApiElb.DNSName

  ExternalApiListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: ExternalApiTargetGroup
      LoadBalancerArn:
        Ref: ExtApiElb
      Port: 6443
      Protocol: TCP

  ExternalApiTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 6443
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  InternalApiListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: InternalApiTargetGroup
      LoadBalancerArn:
        Ref: IntApiElb
      Port: 6443
      Protocol: TCP

  InternalApiTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 6443
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  InternalServiceInternalListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: InternalServiceTargetGroup
      LoadBalancerArn:
        Ref: IntApiElb
      Port: 22623
      Protocol: TCP

  InternalServiceTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 22623
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  RegisterTargetLambdaIamRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Join ["-", [!Ref InfrastructureName, "nlb", "lambda", "role"]]
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "lambda.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "master", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref InternalApiTargetGroup
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref InternalServiceTargetGroup
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref ExternalApiTargetGroup

  RegisterNlbIpTargets:
    Type: "AWS::Lambda::Function"
    Properties:
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
        - "RegisterTargetLambdaIamRole"
        - "Arn"
      Code:
        ZipFile: |
          import json
          import boto3
          import cfnresponse
          def handler(event, context):
            elb = boto3.client('elbv2')
            if event['RequestType'] == 'Delete':
              elb.deregister_targets(TargetGroupArn=event['ResourceProperties']['TargetArn'],Targets=[{'Id': event['ResourceProperties']['TargetIp']}])
            elif event['RequestType'] == 'Create':
              elb.register_targets(TargetGroupArn=event['ResourceProperties']['TargetArn'],Targets=[{'Id': event['ResourceProperties']['TargetIp']}])
            responseData = {}
            cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, event['ResourceProperties']['TargetArn']+event['ResourceProperties']['TargetIp'])
      Runtime: "python3.7"
      Timeout: 120

  RegisterSubnetTagsLambdaIamRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Join ["-", [!Ref InfrastructureName, "subnet-tags-lambda-role"]]
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "lambda.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "subnet-tagging-policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action:
              [
                "ec2:DeleteTags",
                "ec2:CreateTags"
              ]
            Resource: "arn:aws:ec2:*:*:subnet/*"
          - Effect: "Allow"
            Action:
              [
                "ec2:DescribeSubnets",
                "ec2:DescribeTags"
              ]
            Resource: "*"

  RegisterSubnetTags:
    Type: "AWS::Lambda::Function"
    Properties:
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
        - "RegisterSubnetTagsLambdaIamRole"
        - "Arn"
      Code:
        ZipFile: |
          import json
          import boto3
          import cfnresponse
          def handler(event, context):
            ec2_client = boto3.client('ec2')
            if event['RequestType'] == 'Delete':
              for subnet_id in event['ResourceProperties']['Subnets']:
                ec2_client.delete_tags(Resources=[subnet_id], Tags=[{'Key': 'kubernetes.io/cluster/' + event['ResourceProperties']['InfrastructureName']}]);
            elif event['RequestType'] == 'Create':
              for subnet_id in event['ResourceProperties']['Subnets']:
                ec2_client.create_tags(Resources=[subnet_id], Tags=[{'Key': 'kubernetes.io/cluster/' + event['ResourceProperties']['InfrastructureName'], 'Value': 'shared'}]);
            responseData = {}
            cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, event['ResourceProperties']['InfrastructureName']+event['ResourceProperties']['Subnets'][0])
      Runtime: "python3.7"
      Timeout: 120

  RegisterPublicSubnetTags:
    Type: Custom::SubnetRegister
    Properties:
      ServiceToken: !GetAtt RegisterSubnetTags.Arn
      InfrastructureName: !Ref InfrastructureName
      Subnets: !Ref PublicSubnets

  RegisterPrivateSubnetTags:
    Type: Custom::SubnetRegister
    Properties:
      ServiceToken: !GetAtt RegisterSubnetTags.Arn
      InfrastructureName: !Ref InfrastructureName
      Subnets: !Ref PrivateSubnets

Outputs:
  PrivateHostedZoneId:
    Description: Hosted zone ID for the private DNS, which is required for private records.
    Value: !Ref IntDns
  ExternalApiLoadBalancerName:
    Description: Full name of the External API load balancer created.
    Value: !GetAtt ExtApiElb.LoadBalancerFullName
  InternalApiLoadBalancerName:
    Description: Full name of the Internal API load balancer created.
    Value: !GetAtt IntApiElb.LoadBalancerFullName
  ApiServerDnsName:
    Description: Full hostname of the API server, which is required for the Ignition config files.
    Value: !Join [".", ["api-int", !Ref ClusterName, !Ref HostedZoneName]]
  RegisterNlbIpTargetsLambda:
    Description: Lambda ARN useful to help register or deregister IP targets for these load balancers.
    Value: !GetAtt RegisterNlbIpTargets.Arn
  ExternalApiTargetGroupArn:
    Description: ARN of External API target group.
    Value: !Ref ExternalApiTargetGroup
  InternalApiTargetGroupArn:
    Description: ARN of Internal API target group.
    Value: !Ref InternalApiTargetGroup
  InternalServiceTargetGroupArn:
    Description: ARN of internal service target group.
    Value: !Ref InternalServiceTargetGroup

1.5.9. AWS でのセキュリティーグループおよびロールの作成

OpenShift Container Platform クラスターで使用するセキュリティーグループおよびロールを Amazon Web Services (AWS) で作成する必要があります。これらのコンポーネントを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "VpcCidr", 3
        "ParameterValue": "10.0.0.0/16" 4
      },
      {
        "ParameterKey": "PrivateSubnets", 5
        "ParameterValue": "subnet-<random_string>" 6
      },
      {
        "ParameterKey": "VpcId", 7
        "ParameterValue": "vpc-<random_string>" 8
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    VPC の CIDR ブロック。
    4
    x.x.x.x/16-24 の形式で定義した VPC に使用した CIDR ブロックパラメーターを指定します。
    5
    VPC 用に作成したプライベートサブネット。
    6
    VPC の CloudFormation テンプレートの出力から PrivateSubnetIds 値を指定します。
    7
    クラスター用に作成した VPC。
    8
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
  2. このトピックの「セキュリティーオブジェクトの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なセキュリティーグループおよびロールについて記述しています。
  3. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-secs などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  4. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    MasterSecurityGroupId

    マスターセキュリティーグループ ID

    WorkerSecurityGroupId

    ワーカーセキュリティーグループ ID

    MasterInstanceProfile

    マスター IAM インスタンスプロファイル

    WorkerInstanceProfile

    ワーカー IAM インスタンスプロファイル

1.5.9.1. セキュリティーオブジェクトの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なセキュリティーオブジェクトをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Security Elements (Security Groups & IAM)

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 cloud resources and identify items owned or used by the cluster.
    Type: String
  VpcCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    Default: 10.0.0.0/16
    Description: CIDR block for VPC.
    Type: String
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id
  PrivateSubnets:
    Description: The internal subnets.
    Type: List<AWS::EC2::Subnet::Id>

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - VpcCidr
      - PrivateSubnets
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      VpcCidr:
        default: "VPC CIDR"
      PrivateSubnets:
        default: "Private Subnets"

Resources:
  MasterSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Master Security Group
      SecurityGroupIngress:
      - IpProtocol: icmp
        FromPort: 0
        ToPort: 0
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        ToPort: 6443
        FromPort: 6443
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22623
        ToPort: 22623
        CidrIp: !Ref VpcCidr
      VpcId: !Ref VpcId

  WorkerSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Worker Security Group
      SecurityGroupIngress:
      - IpProtocol: icmp
        FromPort: 0
        ToPort: 0
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref VpcCidr
      VpcId: !Ref VpcId

  MasterIngressEtcd:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: etcd
      FromPort: 2379
      ToPort: 2380
      IpProtocol: tcp

  MasterIngressVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  MasterIngressWorkerVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  MasterIngressInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  MasterIngressWorkerInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  MasterIngressKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes kubelet, scheduler and controller manager
      FromPort: 10250
      ToPort: 10259
      IpProtocol: tcp

  MasterIngressWorkerKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes kubelet, scheduler and controller manager
      FromPort: 10250
      ToPort: 10259
      IpProtocol: tcp

  MasterIngressIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  MasterIngressWorkerIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  WorkerIngressVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  WorkerIngressWorkerVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  WorkerIngressInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  WorkerIngressWorkerInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  WorkerIngressKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes secure kubelet port
      FromPort: 10250
      ToPort: 10250
      IpProtocol: tcp

  WorkerIngressWorkerKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal Kubernetes communication
      FromPort: 10250
      ToPort: 10250
      IpProtocol: tcp

  WorkerIngressIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  WorkerIngressWorkerIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  MasterIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "master", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:*"
            Resource: "*"
          - Effect: "Allow"
            Action: "elasticloadbalancing:*"
            Resource: "*"
          - Effect: "Allow"
            Action: "iam:PassRole"
            Resource: "*"
          - Effect: "Allow"
            Action: "s3:GetObject"
            Resource: "*"

  MasterInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Roles:
      - Ref: "MasterIamRole"

  WorkerIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "worker", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:Describe*"
            Resource: "*"

  WorkerInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Roles:
      - Ref: "WorkerIamRole"

Outputs:
  MasterSecurityGroupId:
    Description: Master Security Group ID
    Value: !GetAtt MasterSecurityGroup.GroupId

  WorkerSecurityGroupId:
    Description: Worker Security Group ID
    Value: !GetAtt WorkerSecurityGroup.GroupId

  MasterInstanceProfile:
    Description: Master IAM Instance Profile
    Value: !Ref MasterInstanceProfile

  WorkerInstanceProfile:
    Description: Worker IAM Instance Profile
    Value: !Ref WorkerInstanceProfile

1.5.10. AWS インフラストラクチャーの RHCOS AMI

OpenShift Container Platform ノードについて、Amazon Web Services (AWS) ゾーンの有効な Red Hat Enterprise Linux CoreOS (RHCOS) AMI を使用する必要があります。

表1.9 RHCOS AMI

AWS ゾーンAWS AMI

ap-northeast-1

ami-0426ca3481a088c7b

ap-northeast-2

ami-014514ae47679721b

ap-south-1

ami-0bd772ba746948d9a

ap-southeast-1

ami-0d76ac0ebaac29e40

ap-southeast-2

ami-0391e92574fb09e08

ca-central-1

ami-04419691da69850cf

eu-central-1

ami-092b69120ecf915ed

eu-north-1

ami-0175e9c9d258cc11d

eu-west-1

ami-04370efd78434697b

eu-west-2

ami-00c74e593125e0096

eu-west-3

ami-058ad17da14ff4d0d

sa-east-1

ami-03f6b71e93e630dab

us-east-1

ami-01e7fdcb66157b224

us-east-2

ami-0bc59aaa7363b805d

us-west-1

ami-0ba912f53c1fdcdf0

us-west-2

ami-08e10b201e19fd5e7

1.5.11. AWS でのブートストラップノードの作成

OpenShift Container Platform クラスターの初期化で使用するブートストラップノードを Amazon Web Services (AWS) で作成する必要があります。このノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用してブートストラップノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。

手順

  1. bootstrap.ign Ignition 設定ファイルをクラスターに送るための場所を指定します。このファイルはインストールディレクトリーに置かれます。これを実行するための 1 つの方法として、クラスターのリージョンに S3 バケットを作成し、Ignition 設定ファイルをこれにアップロードします。

    重要

    提供される CloudFormation テンプレートでは、クラスターの Ignition 設定ファイルは S3 バケットから送られることを前提としています。このファイルを別の場所から送ることを選択する場合は、テンプレートを変更する必要があります。

    注記

    ブートストラップ Ignition 設定ファイルには、X.509 キーのようなシークレットが含まれません。以下の手順では、S3 バケットの基本的なセキュリティーを提供します。追加のセキュリティーを提供するには、OpenShift IAM ユーザーなどの特定のユーザーのみがバケットに含まれるオブジェクトにアクセスできるように S3 バケットポリシーを有効にできます。S3 を完全に回避し、ブートストラップマシンが到達できるアドレスからブートストラップ Ignition 設定ファイルを送ることができます。

    1. バケットを作成します。

      $ aws s3 mb s3://<cluster-name>-infra 1
      1
      <cluster-name>-infra はバケット名です。
    2. bootstrap.ign Ignition 設定ファイルをバケットにアップロードします。

      $ aws s3 cp bootstrap.ign s3://<cluster-name>-infra/bootstrap.ign
    3. ファイルがアップロードされていることを確認します。

      $ aws s3 ls s3://<cluster-name>-infra/
      
      2019-04-03 16:15:16     314878 bootstrap.ign
  2. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "RhcosAmi", 3
        "ParameterValue": "ami-<random_string>" 4
      },
      {
        "ParameterKey": "AllowedBootstrapSshCidr", 5
        "ParameterValue": "0.0.0.0/0" 6
      },
      {
        "ParameterKey": "PublicSubnet", 7
        "ParameterValue": "subnet-<random_string>" 8
      },
      {
        "ParameterKey": "MasterSecurityGroupId", 9
        "ParameterValue": "sg-<random_string>" 10
      },
      {
        "ParameterKey": "VpcId", 11
        "ParameterValue": "vpc-<random_string>" 12
      },
      {
        "ParameterKey": "BootstrapIgnitionLocation", 13
        "ParameterValue": "s3://<bucket_name>/bootstrap.ign" 14
      },
      {
        "ParameterKey": "AutoRegisterELB", 15
        "ParameterValue": "yes" 16
      },
      {
        "ParameterKey": "RegisterNlbIpTargetsLambdaArn", 17
        "ParameterValue": "arn:aws:lambda:<region>:<account_number>:function:<dns_stack_name>-RegisterNlbIpTargets-<random_string>" 18
      },
      {
        "ParameterKey": "ExternalApiTargetGroupArn", 19
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Exter-<random_string>" 20
      },
      {
        "ParameterKey": "InternalApiTargetGroupArn", 21
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 22
      },
      {
        "ParameterKey": "InternalServiceTargetGroupArn", 23
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 24
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    ブートストラップノードに使用する最新の Red Hat Enterprise Linux CoreOS (RHCOS) AMI。
    4
    有効な AWS::EC2::Image::Id 値を指定します。
    5
    ブートストラップノードへの SSH アクセスを許可する CIDR ブロック。
    6
    x.x.x.x/16-24 形式で CIDR ブロックを指定します。
    7
    ブートストラップを起動するために VPC に関連付けられるパブリックサブネット。
    8
    VPC の CloudFormation テンプレートの出力から PublicSubnetIds 値を指定します。
    9
    マスターセキュリティーグループ ID (一時ルールの登録用)
    10
    セキュリティーグループおよびロールの CloudFormation テンプレートから MasterSecurityGroupId 値を指定します。
    11
    作成されたリソースが属する VPC。
    12
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
    13
    ブートストラップの Ignition 設定ファイルをフェッチする場所。
    14
    ブートストラップファイルの場所を指定します。s3://<bucket_name>/bootstrap.ign の形式で S3 バケットおよびファイル名を入力します。
    15
    ネットワークロードバランサー (NLB) を登録するかどうか。
    16
    yes または no を指定します。yes を指定する場合、Lambda Amazon Resource Name (ARN) の値を指定する必要があります。
    17
    NLB IP ターゲット登録 lambda グループの ARN。
    18
    DNS および負荷分散の CloudFormation テンプレートの出力から RegisterNlbIpTargetsLambda 値を指定します。
    19
    外部 API ロードバランサーのターゲットグループの ARN。
    20
    DNS および負荷分散の CloudFormation テンプレートの出力から ExternalApiTargetGroupArn 値を指定します。
    21
    内部 API ロードバランサーのターゲットグループの ARN。
    22
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalApiTargetGroupArn 値を指定します。
    23
    内部サービスバランサーのターゲットグループの ARN。
    24
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalServiceTargetGroupArn 値を指定します。
  3. このトピックの「ブートストラップマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なブートストラップマシンについて記述しています。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-bootstrap などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    BootstrapInstanceId

    ブートストラップインスタンス ID。

    BootstrapPublicIp

    ブートストラップノードのパブリック IP アドレス。

    BootstrapPrivateIp

    ブートストラップノードのプライベート IP アドレス。

1.5.11.1. ブートストラップマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なブートストラップマシンをデプロイできます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Bootstrap (EC2 Instance, Security Groups and IAM)

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 cloud resources and identify items owned or used by the cluster.
    Type: String
  RhcosAmi:
    Description: Current Red Hat Enterprise Linux CoreOS AMI to use for bootstrap.
    Type: AWS::EC2::Image::Id
  AllowedBootstrapSshCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|1[0-9]|2[0-9]|3[0-2]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/0-32.
    Default: 0.0.0.0/0
    Description: CIDR block to allow SSH access to the bootstrap node.
    Type: String
  PublicSubnet:
    Description: The public subnet to launch the bootstrap node into.
    Type: AWS::EC2::Subnet::Id
  MasterSecurityGroupId:
    Description: The master security group ID for registering temporary rules.
    Type: AWS::EC2::SecurityGroup::Id
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id
  BootstrapIgnitionLocation:
    Default: s3://my-s3-bucket/bootstrap.ign
    Description: Ignition config file location.
    Type: String
  AutoRegisterELB:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke NLB registration, which requires a Lambda ARN parameter?
    Type: String
  RegisterNlbIpTargetsLambdaArn:
    Description: ARN for NLB IP target registration lambda.
    Type: String
  ExternalApiTargetGroupArn:
    Description: ARN for external API load balancer target group.
    Type: String
  InternalApiTargetGroupArn:
    Description: ARN for internal API load balancer target group.
    Type: String
  InternalServiceTargetGroupArn:
    Description: ARN for internal service load balancer target group.
    Type: String

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Host Information"
      Parameters:
      - RhcosAmi
      - BootstrapIgnitionLocation
      - MasterSecurityGroupId
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - AllowedBootstrapSshCidr
      - PublicSubnet
    - Label:
        default: "Load Balancer Automation"
      Parameters:
      - AutoRegisterELB
      - RegisterNlbIpTargetsLambdaArn
      - ExternalApiTargetGroupArn
      - InternalApiTargetGroupArn
      - InternalServiceTargetGroupArn
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      AllowedBootstrapSshCidr:
        default: "Allowed SSH Source"
      PublicSubnet:
        default: "Public Subnet"
      RhcosAmi:
        default: "Red Hat Enterprise Linux CoreOS AMI ID"
      BootstrapIgnitionLocation:
        default: "Bootstrap Ignition Source"
      MasterSecurityGroupId:
        default: "Master Security Group ID"
      AutoRegisterELB:
        default: "Use Provided ELB Automation"

Conditions:
  DoRegistration: !Equals ["yes", !Ref AutoRegisterELB]

Resources:
  BootstrapIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "bootstrap", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:Describe*"
            Resource: "*"
          - Effect: "Allow"
            Action: "ec2:AttachVolume"
            Resource: "*"
          - Effect: "Allow"
            Action: "ec2:DetachVolume"
            Resource: "*"
          - Effect: "Allow"
            Action: "s3:GetObject"
            Resource: "*"

  BootstrapInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Path: "/"
      Roles:
      - Ref: "BootstrapIamRole"

  BootstrapSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Bootstrap Security Group
      SecurityGroupIngress:
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref AllowedBootstrapSshCidr
      - IpProtocol: tcp
        ToPort: 19531
        FromPort: 19531
        CidrIp: 0.0.0.0/0
      VpcId: !Ref VpcId

  BootstrapInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      IamInstanceProfile: !Ref BootstrapInstanceProfile
      InstanceType: "i3.large"
      NetworkInterfaces:
      - AssociatePublicIpAddress: "true"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "BootstrapSecurityGroup"
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "PublicSubnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"replace":{"source":"${S3Loc}","verification":{}}},"timeouts":{},"version":"2.1.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          S3Loc: !Ref BootstrapIgnitionLocation
        }

  RegisterBootstrapApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

  RegisterBootstrapInternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

  RegisterBootstrapInternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

Outputs:
  BootstrapInstanceId:
    Description: Bootstrap Instance ID.
    Value: !Ref BootstrapInstance

  BootstrapPublicIp:
    Description: The bootstrap node public IP address.
    Value: !GetAtt BootstrapInstance.PublicIp

  BootstrapPrivateIp:
    Description: The bootstrap node private IP address.
    Value: !GetAtt BootstrapInstance.PrivateIp

1.5.12. AWS でのコントロールプレーンの作成

クラスターで使用するコントロールプレーンマシンを Amazon Web Services (AWS) で作成する必要があります。これらのノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用してコントロールプレーンノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "RhcosAmi", 3
        "ParameterValue": "ami-<random_string>" 4
      },
      {
        "ParameterKey": "AutoRegisterDNS", 5
        "ParameterValue": "yes" 6
      },
      {
        "ParameterKey": "PrivateHostedZoneId", 7
        "ParameterValue": "<random_string>" 8
      },
      {
        "ParameterKey": "PrivateHostedZoneName", 9
        "ParameterValue": "mycluster.example.com" 10
      },
      {
        "ParameterKey": "Master0Subnet", 11
        "ParameterValue": "subnet-<random_string>" 12
      },
      {
        "ParameterKey": "Master1Subnet", 13
        "ParameterValue": "subnet-<random_string>" 14
      },
      {
        "ParameterKey": "Master2Subnet", 15
        "ParameterValue": "subnet-<random_string>" 16
      },
      {
        "ParameterKey": "MasterSecurityGroupId", 17
        "ParameterValue": "sg-<random_string>" 18
      },
      {
        "ParameterKey": "IgnitionLocation", 19
        "ParameterValue": "https://api-int.<cluster_name>.<domain_name>:22623/config/master" 20
      },
      {
        "ParameterKey": "CertificateAuthorities", 21
        "ParameterValue": "data:text/plain;charset=utf-8;base64,ABC...xYz==" 22
      },
      {
        "ParameterKey": "MasterInstanceProfileName", 23
        "ParameterValue": "<roles_stack>-MasterInstanceProfile-<random_string>" 24
      },
      {
        "ParameterKey": "MasterInstanceType", 25
        "ParameterValue": "m4.xlarge" 26
      },
      {
        "ParameterKey": "AutoRegisterELB", 27
        "ParameterValue": "yes" 28
      },
      {
        "ParameterKey": "RegisterNlbIpTargetsLambdaArn", 29
        "ParameterValue": "arn:aws:lambda:<region>:<account_number>:function:<dns_stack_name>-RegisterNlbIpTargets-<random_string>" 30
      },
      {
        "ParameterKey": "ExternalApiTargetGroupArn", 31
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Exter-<random_string>" 32
      },
      {
        "ParameterKey": "InternalApiTargetGroupArn", 33
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 34
      },
      {
        "ParameterKey": "InternalServiceTargetGroupArn", 35
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 36
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    コントロールプレーンマシンに使用する最新の Red Hat Enterprise Linux CoreOS (RHCOS) AMI。
    4
    AWS::EC2::Image::Id 値を指定します。
    5
    DNS etcd 登録を実行するかどうか。
    6
    yes または no を指定します。yes を指定する場合、ホストゾーンの情報を指定する必要があります。
    7
    etcd ターゲットの登録に使用する Route53 プライベートゾーン ID。
    8
    DNS および負荷分散の CloudFormation テンプレートの出力から PrivateHostedZoneId 値を指定します。
    9
    ターゲットの登録に使用する Route53 ゾーン。
    10
    <cluster_name>.<domain_name> を指定します。ここで、<domain_name> はクラスターの install-config.yaml ファイルの生成時に使用した Route53 ベースドメインです。AWS コンソールに表示される末尾のピリド (.) は含めないでください。
    11 13 15
    コントロールプレーンマシンの起動に使用するサブネット (プライベートが望ましい)。
    12 14 16
    DNS および負荷分散の CloudFormation テンプレートの出力から PrivateSubnets 値のサブネットを指定します。
    17
    マスターノードに関連付けるマスターセキュリティーグループ ID。
    18
    セキュリティーグループおよびロールの CloudFormation テンプレートから MasterSecurityGroupId 値を指定します。
    19
    コントロールプレーンの Ignition 設定ファイルをフェッチする場所。
    20
    生成される Ignition 設定ファイルの場所を指定します (https://api-int.<cluster_name>.<domain_name>:22623/config/master)。
    21
    使用する base64 でエンコードされた認証局の文字列。
    22
    インストールディレクトリーにある master.ign ファイルから値を指定します。この値は、data:text/plain;charset=utf-8;base64,ABC…​xYz== 形式の長い文字列です。
    23
    マスターロールに関連付ける IAM プロファイル。
    24
    セキュリティーグループおよびロールの CloudFormation テンプレートの出力から MasterInstanceProfile パラメーターの値を指定します。
    25
    コントロールプレーンマシンに使用する AWS インスタンスのタイプ。
    26
    許可される値:
    • m4.xlarge
    • m4.2xlarge
    • m4.4xlarge
    • m4.8xlarge
    • m4.10xlarge
    • m4.16xlarge
    • c4.2xlarge
    • c4.4xlarge
    • c4.8xlarge
    • r4.xlarge
    • r4.2xlarge
    • r4.4xlarge
    • r4.8xlarge
    • r4.16xlarge

      重要

      m4 インスタンスタイプが eu-west-3 などのリージョンで利用可能ではない場合、m5.xlarge などのように m5 タイプを代わりに使用します。

    27
    ネットワークロードバランサー (NLB) を登録するかどうか。
    28
    yes または no を指定します。yes を指定する場合、Lambda Amazon Resource Name (ARN) の値を指定する必要があります。
    29
    NLB IP ターゲット登録 lambda グループの ARN。
    30
    DNS および負荷分散の CloudFormation テンプレートの出力から RegisterNlbIpTargetsLambda 値を指定します。
    31
    外部 API ロードバランサーのターゲットグループの ARN。
    32
    DNS および負荷分散の CloudFormation テンプレートの出力から ExternalApiTargetGroupArn 値を指定します。
    33
    内部 API ロードバランサーのターゲットグループの ARN。
    34
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalApiTargetGroupArn 値を指定します。
    35
    内部サービスバランサーのターゲットグループの ARN。
    36
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalServiceTargetGroupArn 値を指定します。
  2. このトピックの「コントロールプレーンマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なコントロールプレーンのマシンについて記述しています。
  3. m5 インスタンスタイプを MasterInstanceType の値として指定している場合、そのインスタンスタイプを CloudFormation テンプレートの MasterInstanceType.AllowedValues パラメーターに追加します。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
    1
    <name>cluster-control-plane などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

1.5.12.1. コントロールプレーンマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なコントロールプレーンマシンをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Node Launch (EC2 master instances)

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
  AutoRegisterDNS:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke DNS etcd registration, which requires Hosted Zone information?
    Type: String
  PrivateHostedZoneId:
    Description: The Route53 private zone ID to register the etcd targets with, such as Z21IXYZABCZ2A4.
    Type: String
  PrivateHostedZoneName:
    Description: The Route53 zone to register the targets with, such as cluster.example.com. Omit the trailing period.
    Type: String
  Master0Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  Master1Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  Master2Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  MasterSecurityGroupId:
    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/master
    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
  MasterInstanceProfileName:
    Description: IAM profile to associate with master nodes.
    Type: String
  MasterInstanceType:
    Default: m4.xlarge
    Type: String
    AllowedValues:
    - "m4.xlarge"
    - "m4.2xlarge"
    - "m4.4xlarge"
    - "m4.8xlarge"
    - "m4.10xlarge"
    - "m4.16xlarge"
    - "c4.2xlarge"
    - "c4.4xlarge"
    - "c4.8xlarge"
    - "r4.xlarge"
    - "r4.2xlarge"
    - "r4.4xlarge"
    - "r4.8xlarge"
    - "r4.16xlarge"
  AutoRegisterELB:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke NLB registration, which requires a Lambda ARN parameter?
    Type: String
  RegisterNlbIpTargetsLambdaArn:
    Description: ARN for NLB IP target registration lambda. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  ExternalApiTargetGroupArn:
    Description: ARN for external API load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  InternalApiTargetGroupArn:
    Description: ARN for internal API load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  InternalServiceTargetGroupArn:
    Description: ARN for internal service load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Host Information"
      Parameters:
      - MasterInstanceType
      - RhcosAmi
      - IgnitionLocation
      - CertificateAuthorities
      - MasterSecurityGroupId
      - MasterInstanceProfileName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - AllowedBootstrapSshCidr
      - Master0Subnet
      - Master1Subnet
      - Master2Subnet
    - Label:
        default: "DNS"
      Parameters:
      - AutoRegisterDNS
      - PrivateHostedZoneName
      - PrivateHostedZoneId
    - Label:
        default: "Load Balancer Automation"
      Parameters:
      - AutoRegisterELB
      - RegisterNlbIpTargetsLambdaArn
      - ExternalApiTargetGroupArn
      - InternalApiTargetGroupArn
      - InternalServiceTargetGroupArn
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      Master0Subnet:
        default: "Master-0 Subnet"
      Master1Subnet:
        default: "Master-1 Subnet"
      Master2Subnet:
        default: "Master-2 Subnet"
      MasterInstanceType:
        default: "Master Instance Type"
      MasterInstanceProfileName:
        default: "Master Instance Profile Name"
      RhcosAmi:
        default: "Red Hat Enterprise Linux CoreOS AMI ID"
      BootstrapIgnitionLocation:
        default: "Master Ignition Source"
      CertificateAuthorities:
        default: "Ignition CA String"
      MasterSecurityGroupId:
        default: "Master Security Group ID"
      AutoRegisterDNS:
        default: "Use Provided DNS Automation"
      AutoRegisterELB:
        default: "Use Provided ELB Automation"
      PrivateHostedZoneName:
        default: "Private Hosted Zone Name"
      PrivateHostedZoneId:
        default: "Private Hosted Zone ID"

Conditions:
  DoRegistration: !Equals ["yes", !Ref AutoRegisterELB]
  DoDns: !Equals ["yes", !Ref AutoRegisterDNS]

Resources:
  Master0:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master0Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster0:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  RegisterMaster0InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  RegisterMaster0InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  Master1:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master1Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster1:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  RegisterMaster1InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  RegisterMaster1InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  Master2:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master2Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster2:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  RegisterMaster2InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  RegisterMaster2InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  EtcdSrvRecords:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["_etcd-server-ssl._tcp", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-0", !Ref PrivateHostedZoneName]]],
      ]
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-1", !Ref PrivateHostedZoneName]]],
      ]
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-2", !Ref PrivateHostedZoneName]]],
      ]
      TTL: 60
      Type: SRV

  Etcd0Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-0", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master0.PrivateIp
      TTL: 60
      Type: A

  Etcd1Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-1", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master1.PrivateIp
      TTL: 60
      Type: A

  Etcd2Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-2", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master2.PrivateIp
      TTL: 60
      Type: A

Outputs:
  PrivateIPs:
    Description: The control-plane node private IP addresses.
    Value:
      !Join [
        ",",
        [!GetAtt Master0.PrivateIp, !GetAtt Master1.PrivateIp, !GetAtt Master2.PrivateIp]
      ]

1.5.13. ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS でのブートストラップノードの初期化

Amazon Web Services (AWS) ですべての必要なインフラストラクチャーを作成した後に、クラスターをインストールできます。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。
  • コントロールプレーンマシンを作成します。
  • ワーカーマシンを手動で管理する予定の場合には、ワーカーマシンを作成します。

手順

  1. インストールプログラムが含まれるディレクトリーに切り替え、以下のコマンドを実行します。

    $ ./openshift-install wait-for bootstrap-complete --dir=<installation_directory> \ 1
        --log-level=info 2
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    2
    異なるインストールの詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。

    コマンドが FATAL 警告を出さずに終了する場合、実稼働用のコントロールプレーンは初期化されています。

1.5.13.1. AWS でのワーカーノードの作成

クラスターで使用するワーカーノードを Amazon Web Services (AWS) で作成できます。これらのノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

重要

CloudFormation テンプレートは、1 つのワーカーマシンを表すスタックを作成します。それぞれのワーカーマシンにスタックを作成する必要があります。

注記

提供される CloudFormation テンプレートを使用してワーカーノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。
  • コントロールプレーンマシンを作成します。

手順

  1. 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
    • c4.large
    • c4.xlarge
    • c4.2xlarge
    • c4.4xlarge
    • c4.8xlarge
    • r4.large
    • r4.xlarge
    • r4.2xlarge
    • r4.4xlarge
    • r4.8xlarge
    • r4.16xlarge

      重要

      m4 インスタンスが eu-west-3 などのリージョンで利用可能ではない場合、m5 タイプを代わりに使用します。

  2. このトピックの「ワーカーマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なネットワークオブジェクトおよびロードバランサーについて記述しています。
  3. m5 インスタンスタイプを WorkerInstanceType の値として指定している場合、そのインスタンスタイプを CloudFormation テンプレートの WorkerInstanceType.AllowedValues パラメーターに追加します。
  4. ワーカースタックを作成します。

    1. テンプレートを起動します。

      重要

      単一行にコマンドを入力してください。

      $ aws cloudformation create-stack --stack-name <name> 1
           --template-body file://<template>.yaml \ 2
           --parameters file://<parameters>.json 3
      1
      <name>cluster-workers などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
      2
      <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
      3
      <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
    2. テンプレートのコンポーネントが存在することを確認します。

      $ aws cloudformation describe-stacks --stack-name <name>
  5. クラスターに作成するワーカーマシンが十分な数に達するまでワーカースタックの作成を継続します。

    重要

    2 つ以上のワーカーマシンを作成する必要があるため、この CloudFormation テンプレートを使用する 2 つ以上のスタックを作成する必要があります。

1.5.13.1.1. ワーカーマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なワーカーマシンをデプロイすることができます。

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: m4.large
    Type: String
    AllowedValues:
    - "m4.large"
    - "m4.xlarge"
    - "m4.2xlarge"
    - "m4.4xlarge"
    - "m4.8xlarge"
    - "m4.10xlarge"
    - "m4.16xlarge"
    - "c4.large"
    - "c4.xlarge"
    - "c4.2xlarge"
    - "c4.4xlarge"
    - "c4.8xlarge"
    - "r4.large"
    - "r4.xlarge"
    - "r4.2xlarge"
    - "r4.4xlarge"
    - "r4.8xlarge"
    - "r4.16xlarge"

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":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          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

1.5.14. CLI のインストール

コマンドラインインターフェースを使用して OpenShift Container Platform と対話するために CLI をインストールすることができます。

重要

以前のバージョンの oc をインストールしている場合、これを使用して OpenShift Container Platform 4.2 のすべてのコマンドを実行することはできません。新規バージョンの ocをダウンロードし、インストールします。

手順

  1. Red Hat OpenShift Cluster Manager サイトの Infrastructure Provider ページから、選択するインストールタイプのページに移動し、Download Command-line Tools をクリックします。
  2. オペレーティングシステムおよびアーキテクチャーのフォルダーをクリックしてから、圧縮されたファイルをクリックします。

    注記

    oc は Linux、Windows、または macOS にインストールできます。

  3. ファイルをファイルシステムに保存します。
  4. 圧縮ファイルを展開します。
  5. これを PATH にあるディレクトリーに配置します。

CLI のインストール後は、oc コマンドを使用して利用できます。

$ oc <command>

1.5.15. クラスターへのログイン

クラスター kubeconfig ファイルをエクスポートし、デフォルトシステムユーザーとしてクラスターにログインできます。kubeconfig ファイルには、クライアントを正しいクラスターおよび API サーバーに接続するために CLI で使用されるクラスターについての情報が含まれます。このファイルはクラスターに固有のファイルであり、OpenShift Container Platform のインストール時に作成されます。

前提条件

  • OpenShift Container Platform クラスターのデプロイ。
  • oc CLI のインストール。

手順

  1. kubeadmin 認証情報をエクスポートします。

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
  2. エクスポートされた設定を使用して、oc コマンドを正常に実行できることを確認します。

    $ oc whoami
    system:admin

1.5.16. マシンの CSR の承認

マシンをクラスターに追加する際に、追加したそれぞれのマシンについて 2 つの保留状態の証明書署名要求 (CSR) が生成されます。これらの CSR が承認されていることを確認するか、または必要な場合はそれらを承認してください。

前提条件

  • マシンをクラスターに追加していること。

手順

  1. クラスターがマシンを認識していることを確認します。

    $ oc get nodes
    
    NAME      STATUS    ROLES   AGE  VERSION
    master-0  Ready     master  63m  v1.14.6+c4799753c
    master-1  Ready     master  63m  v1.14.6+c4799753c
    master-2  Ready     master  64m  v1.14.6+c4799753c
    worker-0  NotReady  worker  76s  v1.14.6+c4799753c
    worker-1  NotReady  worker  70s  v1.14.6+c4799753c

    出力には作成したすべてのマシンが一覧表示されます。

  2. 保留中の証明書署名要求 (CSR) を確認し、クラスターに追加したそれぞれのマシンのクライアントおよびサーバー要求に Pending または Approved ステータスが表示されていることを確認します。

    $ oc get csr
    
    NAME        AGE     REQUESTOR                                                                   CONDITION
    csr-8b2br   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending 1
    csr-8vnps   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending
    csr-bfd72   5m26s   system:node:ip-10-0-50-126.us-east-2.compute.internal                       Pending 2
    csr-c57lv   5m26s   system:node:ip-10-0-95-157.us-east-2.compute.internal                       Pending
    ...
    1
    クライアント要求の CSR。
    2
    サーバー要求の CSR。

    この例では、2 つのマシンがクラスターに参加しています。この一覧にはさらに多くの承認された CSR が表示される可能性があります。

  3. 追加したマシンの保留中の CSR すべてが Pending ステータスになった後に CSR が承認されない場合には、クラスターマシンの CSR を承認します。

    注記

    CSR のローテーションは自動的に実行されるため、クラスターにマシンを追加後 1 時間以内に CSR を承認してください。1 時間以内に承認しない場合には、証明書のローテーションが行われ、各ノードに 3 つ以上の証明書が存在するようになります。これらの証明書すべてを承認する必要があります。最初の CSR の承認後、後続のノードクライアント CSR はクラスターの kube-controller-manger によって自動的に承認されます。kubelet 提供証明書の要求を自動的に承認する方法を実装する必要があります。

    • それらを個別に承認するには、それぞれの有効な CSR について以下のコマンドを実行します。

      $ oc adm certificate approve <csr_name> 1
      1
      <csr_name> は、現行の CSR の一覧からの CSR の名前です。
    • すべての保留中の CSR を承認するには、以下のコマンドを実行します。

      $ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs oc adm certificate approve

1.5.17. Operator の初期設定

コントロールプレーンの初期化後に、一部の Operator を利用可能にするためにそれらをすぐに設定する必要があります。

前提条件

  • コントロールプレーンが初期化されていること。

手順

  1. クラスターコンポーネントがオンラインになることを確認します。

    $ watch -n5 oc get clusteroperators
    
    NAME                                 VERSION   AVAILABLE   PROGRESSING   DEGRADED   SINCE
    authentication                       4.2.0     True        False         False      69s
    cloud-credential                     4.2.0     True        False         False      12m
    cluster-autoscaler                   4.2.0     True        False         False      11m
    console                              4.2.0     True        False         False      46s
    dns                                  4.2.0     True        False         False      11m
    image-registry                       4.2.0     False       True          False      5m26s
    ingress                              4.2.0     True        False         False      5m36s
    kube-apiserver                       4.2.0     True        False         False      8m53s
    kube-controller-manager              4.2.0     True        False         False      7m24s
    kube-scheduler                       4.2.0     True        False         False      12m
    machine-api                          4.2.0     True        False         False      12m
    machine-config                       4.2.0     True        False         False      7m36s
    marketplace                          4.2.0     True        False         False      7m54m
    monitoring                           4.2.0     True        False         False      7h54s
    network                              4.2.0     True        False         False      5m9s
    node-tuning                          4.2.0     True        False         False      11m
    openshift-apiserver                  4.2.0     True        False         False      11m
    openshift-controller-manager         4.2.0     True        False         False      5m943s
    openshift-samples                    4.2.0     True        False         False      3m55s
    operator-lifecycle-manager           4.2.0     True        False         False      11m
    operator-lifecycle-manager-catalog   4.2.0     True        False         False      11m
    service-ca                           4.2.0     True        False         False      11m
    service-catalog-apiserver            4.2.0     True        False         False      5m26s
    service-catalog-controller-manager   4.2.0     True        False         False      5m25s
    storage                              4.2.0     True        False         False      5m30s
  2. 利用不可の Operator を設定します。

1.5.17.1. イメージレジストリーストレージの設定

image-registry Operator が利用できない場合、そのストレージを設定する必要があります。実稼働クラスターに必要な PersistentVolume の設定方法と、実稼働用ではないクラスターにのみ使用できる空のディレクトリーをストレージの場所として設定する方法が表示されます。

1.5.17.1.1. ユーザーによってプロビジョニングされるインフラストラクチャーで AWS のレジストリーストレージを設定する

インストール時に、S3 バケットを作成するにはクラウド認証情報を使用でき、レジストリー Operator がストレージを自動的に設定します。

レジストリー Operator が S3 バケットを作成できず、ストレージを自動的に設定する場合、以下の手順により S3 バケットを作成し、ストレージを設定することができます。

前提条件

  • ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS 上のクラスター
  • AWS ストレージの S3 の場合、シークレットには以下のキーが含まれることが予想されます。

    • REGISTRY_STORAGE_S3_ACCESSKEY
    • REGISTRY_STORAGE_S3_SECRETKEY

手順

レジストリー Operator が S3 バケットを作成できず、ストレージを自動的に設定する場合は、以下の手順を使用してください。

  1. バケットライフサイクルポリシーを設定し、1 日以上経過している未完了のマルチパートアップロードを中止します。
  2. configs.imageregistry.operator.openshift.io/cluster にストレージ設定を入力します。

    $ oc edit configs.imageregistry.operator.openshift.io/cluster
    
    storage:
      s3:
        bucket: <bucket-name>
        region: <region-name>
警告

AWS でレジストリーイメージのセキュリティーを保護するには、S3 バケットに対してパブリックアクセスのブロックを実行します。

1.5.17.1.2. 実稼働以外のクラスターでのイメージレジストリーのストレージの設定

イメージレジストリー Operator のストレージを設定する必要があります。実稼働用以外のクラスターの場合、イメージレジストリーは空のディレクトリーに設定することができます。これを実行する場合、レジストリーを再起動するとすべてのイメージが失われます。

手順

  • イメージレジストリーストレージを空のディレクトリーに設定するには、以下を実行します。

    $ oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
    警告

    実稼働用以外のクラスターにのみこのオプションを設定します。

    イメージレジストリー Operator がそのコンポーネントを初期化する前にこのコマンドを実行する場合、oc patch コマンドは以下のエラーを出して失敗します。

    Error from server (NotFound): configs.imageregistry.operator.openshift.io "cluster" not found

    数分待機した後に、このコマンドを再び実行します。

1.5.18. ブートストラップリソースの削除

クラスターの初期 Operator 設定の完了後に、Amazon Web Services (AWS) からブートストラップリソースを削除します。

前提条件

  • クラスターの初期 Operator 設定を完了している。

手順

  1. ブートストラップリソースを削除します。CloudFormation テンプレートを使用した場合は、 そのスタックを削除します。

    $ aws cloudformation delete-stack --stack-name <name> 1
    1
    <name> は、ブートストラップスタックの名前です。

1.5.19. Ingress DNS レコードの作成

DNS ゾーン設定を削除した場合には、Ingress ロードバランサーを参照する DNS レコードを手動で作成します。ワイルドカードレコードまたは特定のレコードのいずれかを作成できます。以下の手順では A レコードを使用しますが、CNAME やエイリアスなどの必要な他のレコードタイプを使用できます。

前提条件

  • 独自にプロビジョニングしたインフラストラクチャーを使用する OpenShift Container Platform クラスターを Amazon Web Services (AWS) にデプロイしている。
  • oc として知られる OpenShift コマンドラインインターフェース (CLI) のインストール。
  • jq パッケージのインストール。
  • AWS CLI をダウンロードし、これをコンピューターにインストールします。「Install the AWS CLI Using the Bundled Installer (Linux, macOS, or Unix)」を参照してください。

手順

  1. 作成するルートを決定します。

    • ワイルドカードレコードを作成するには、*.apps.<cluster_name>.<domain_name> を使用します。ここで、<cluster_name> はクラスター名で、<domain_name> は OpenShift Container Platform クラスターの Route53 ベースドメインです。
    • 特定のレコードを作成するには、以下のコマンドの出力にあるように、クラスターが使用する各ルートにレコードを作成する必要があります。

      $ oc get --all-namespaces -o jsonpath='{range .items[*]}{range .status.ingress[*]}{.host}{"\n"}{end}{end}' routes
      oauth-openshift.apps.<cluster_name>.<domain_name>
      console-openshift-console.apps.<cluster_name>.<domain_name>
      downloads-openshift-console.apps.<cluster_name>.<domain_name>
      alertmanager-main-openshift-monitoring.apps.<cluster_name>.<domain_name>
      grafana-openshift-monitoring.apps.<cluster_name>.<domain_name>
      prometheus-k8s-openshift-monitoring.apps.<cluster_name>.<domain_name>
  2. Ingress Operator ロードバランサーのステータスを取得し、使用する外部 IP アドレスの値をメモします。これは EXTERNAL-IP 列に表示されます。

    $ oc -n openshift-ingress get service router-default
    NAME             TYPE           CLUSTER-IP      EXTERNAL-IP                            PORT(S)                      AGE
    router-default   LoadBalancer   172.30.62.215   ab3...28.us-east-2.elb.amazonaws.com   80:31499/TCP,443:30693/TCP   5m
  3. ロードバランサーのホストゾーン ID を見つけます。

    $ aws elb describe-load-balancers | jq -r '.LoadBalancerDescriptions[] | select(.DNSName == "<external_ip>").CanonicalHostedZoneNameID' 1
    
    Z3AADJGX6KTTL2
    1
    <external_ip> については、取得した Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。

    このコマンドの出力は、ロードバランサーのホストゾーン ID です。

  4. クラスターのドメインのパブリックホストゾーン ID を取得します。

    $ aws route53 list-hosted-zones-by-name \
                --dns-name "<domain_name>" \ 1
                --query 'HostedZones[? Config.PrivateZone != `true` && Name == `<domain_name>.`].Id' 2
                --output text
    
    /hostedzone/Z3URY6TWQ91KVV
    1 2
    <domain_name>については、OpenShift Container Platform クラスターの Route53 ベースドメインを指定します。

    ドメインのパブリックホストゾーン ID がコマンド出力に表示されます。この例では、これは Z3URY6TWQ91KVV になります。

  5. プライベートゾーンにエイリアスレコードを追加します。

    $ aws route53 change-resource-record-sets --hosted-zone-id "<private_hosted_zone_id>" --change-batch '{ 1
    >   "Changes": [
    >     {
    >       "Action": "CREATE",
    >       "ResourceRecordSet": {
    >         "Name": "\\052.apps.<cluster_domain>", 2
    >         "Type": "A",
    >         "AliasTarget":{
    >           "HostedZoneId": "<hosted_zone_id>", 3
    >           "DNSName": "<external_ip>.", 4
    >           "EvaluateTargetHealth": false
    >         }
    >       }
    >     }
    >   ]
    > }'
    1
    <private_hosted_zone_id> については、DNS および負荷分散の CloudFormation テンプレートの出力から値を指定します。
    2
    <cluster_domain>については、OpenShift Container Platform クラスターで使用するドメインまたはサブドメインを指定します。
    3
    <hosted_zone_id> については、取得したロードバランサーのパブリックホストゾーン ID を指定します。
    4
    <external_ip> については、Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。このパラメーターの値に末尾のピリオド (.) が含まれていることを確認します。
  6. パブリックゾーンにレコードを追加します。

    $ aws route53 change-resource-record-sets --hosted-zone-id "<public_hosted_zone_id>"" --change-batch '{ 1
    >   "Changes": [
    >     {
    >       "Action": "CREATE",
    >       "ResourceRecordSet": {
    >         "Name": "\\052.apps.<cluster_domain>", 2
    >         "Type": "A",
    >         "AliasTarget":{
    >           "HostedZoneId": "<hosted_zone_id>", 3
    >           "DNSName": "<external_ip>.", 4
    >           "EvaluateTargetHealth": false
    >         }
    >       }
    >     }
    >   ]
    > }'
    1
    <public_hosted_zone_id> については、ドメインのパブリックホストゾーンを指定します。
    2
    <cluster_domain>については、OpenShift Container Platform クラスターで使用するドメインまたはサブドメインを指定します。
    3
    <hosted_zone_id> については、取得したロードバランサーのパブリックホストゾーン ID を指定します。
    4
    <external_ip> については、Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。このパラメーターの値に末尾のピリオド (.) が含まれていることを確認します。

1.5.20. ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS インストールの実行

Amazon Web Service (AWS) のユーザーによってプロビジョニングされるインフラストラクチャーで OpenShift Container Platform のインストールを開始した後に、デプロイメントを完了するまでモニターします。

前提条件

  • OpenShift Container Platform クラスターのブートストラップノードを、ユーザーによってプロビジョニングされた AWS インフラストラクチャーで削除していること。
  • oc CLI のインストールおよびログイン。

手順

  • クラスターのインストールを完了します。

    $ ./openshift-install --dir=<installation_directory> wait-for install-complete 1
    
    INFO Waiting up to 30m0s for the cluster to initialize...
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    重要

    インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

次のステップ

1.6. ミラーリングされたインストールコンテンツを使用するクラスターの AWS へのインストール

OpenShift Container Platform バージョン 4.2 では、各自でプロビジョニングするインフラストラクチャーおよびインストールリリースコンテンツの内部ミラーを使用して、クラスターを Amazon Web Services (AWS) にインストールできます

重要

ミラーリングされたインストールリリースのコンテンツを使用して OpenShift Container Platform クラスターをインストールすることは可能ですが、クラスターが AWS API を使用するにはインターネットへのアクセスが必要になります。

このインフラストラクチャーを作成する 1 つの方法として、提供される CloudFormation テンプレートを使用できます。テンプレートを変更してインフラストラクチャーをカスタマイズしたり、それらに含まれる情報を使用し、所属する会社のポリシーに基づいて AWS オブジェクトを作成したりできます。

前提条件

  • bastion ホストでミラーレジストリーを作成し、OpenShift Container Platform の使用しているバージョン用の imageContentSources データを取得します。

    重要

    インストールメディアは bastion ホストにあるため、そのコンピューターを使用してすべてのインストール手順を完了します。

  • OpenShift Container Platform のインストールおよび更新プロセスについての詳細を確認します。
  • AWS アカウントを設定してクラスターをホストします。

    重要

    AWS プロファイルがご使用のコンピューターに保存されている場合、マルチファクター認証デバイスを使用中に生成した一時的なセッショントークンを使用することはできません。クラスターは継続的に現行の AWS 認証情報を使用して、クラスターの有効期間全体にわたって AWS リソースを作成するため、キーをベースとした有効期間の長い認証情報を使用する必要があります。適切なキーを生成するには、AWS ドキュメントの「Managing Access Keys for IAM Users」を参照してください。キーは、インストールプログラムの実行時に指定できます。

  • AWS CLI をダウンロードし、これをコンピューターにインストールします。AWS ドキュメントの「Install the AWS CLI Using the Bundled Installer (Linux, macOS, or Unix)」を参照してください。
  • ファイアウォールを使用し、Telemetry を使用する予定がある場合は、クラスターがアクセスする必要のあるサイトを許可するようにファイアウォールを設定する必要があります。

    注記

    プロキシーを設定する場合は、このサイト一覧も確認してください。

1.6.1. ネットワークが制限された環境でのインストールについて

OpenShift Container Platform 4.2 では、ソフトウェアコンポーネントを取得するためにインターネットへのアクティブな接続を必要としないインストールを実行できます。インストールプログラムでプロビジョニングされるインフラストラクチャーではなく、ユーザーによってプロビジョニングされるインフラストラクチャー上でのみネットワークが制限された環境でのインストールを実行します。そのため、プラットフォームの選択は制限されます。

クラウドプラットフォーム上でネットワークが制限されたインストールの実行を選択した場合でも、そのクラウド API へのアクセスが必要になります。Amazon Web Service の IAM サービスなどの一部のクラウド機能はインターネットアクセスを必要とするため、インターネットアクセスが依然として必要になる場合があります。ネットワークによっては、ベアメタルハードウェアまたは VMware vSphere へのインストールには、インターネットアクセスが必要になる場合があります。

ネットワークが制限されたインストールを完了するには、OpenShift Container Platform レジストリーのコンテンツをミラーリングし、インストールメディアを含むレジストリーを作成する必要があります。このミラーは、インターネットと制限されたネットワークの両方にアクセスできる bastion ホストで、または制限に対応する他の方法を使用して作成できます。

重要

ネットワークが制限されたインストールはユーザーによってプロビジョニングされるインフラストラクチャーを常に使用します。ユーザーによってプロビジョニングされるインストールの設定は複雑であるため、ネットワークが制限されたインストールを試行する前に、標準的なユーザーによってプロビジョニングされるインフラストラクチャーを実行することを検討してください。このテストが完了すると、ネットワークが制限されたインストール時に発生する可能性のある問題の切り分けやトラブルシューティングがより容易になります。

1.6.1.1. その他の制限

ネットワークが制限された環境のクラスターには、以下の追加の制限および制約があります。

  • ClusterVersion ステータスには Unable to retrieve available updates エラーが含まれます。
  • デフォルトで、開発者カタログのコンテンツは、必要とされる ImageStreamTag にアクセスできないために使用できません。

1.6.2. OpenShift Container Platform のインターネットアクセスおよび Telemetry アクセス

OpenShift Container Platform 4.2 では、クラスターをインストールするためにインターネットアクセスが必要になります。クラスターの健全性および正常に実行された更新についてのメトリクスを提供するためにデフォルトで実行される Telemetry サービスにもインターネットアクセスが必要です。クラスターがインターネットに接続されている場合、Telemetry は自動的に実行され、クラスターは Red Hat OpenShift Cluster Manager (OCM) に登録されます。

Red Hat OpenShift Cluster Manager インベントリーが Telemetry によって自動的に維持されるか、または OCM を手動で使用しているかのいずれによって正常であることを確認した後に、subscription watch を使用して、アカウントまたはマルチクラスターレベルで OpenShift Container Platform サブスクリプションを追跡します。

インターネットへのアクセスは以下を実行するために必要です。

  • Red Hat OpenShift Cluster Manager ページにアクセスし、インストールプログラムをダウンロードし、サブスクリプション管理を実行します。クラスターにインターネットアクセスがあり、Telemetry を無効にしない場合、そのサービスは有効なサブスクリプションでクラスターを自動的に使用します。
  • クラスターのインストールに必要なパッケージを取得するために Quay.io にアクセスします。
  • クラスターの更新を実行するために必要なパッケージを取得します。
重要

クラスターでインターネットに直接アクセスできない場合、プロビジョニングする一部のタイプのインフラストラクチャーでネットワークが制限されたインストールを実行できます。このプロセスで、必要なコンテンツをダウンロードし、これを使用してミラーレジストリーにクラスターのインストールおよびインストールプログラムの生成に必要なパッケージを設定します。 インストールタイプによっては、クラスターのインストール環境でインターネットアクセスが不要となる場合があります。クラスターを更新する前に、ミラーレジストリーのコンテンツを更新します。

1.6.3. 必要な AWS インフラストラクチャーコンポーネント

OpenShift Container Platform を Amazon Web Services (AWS) のユーザーによってプロビジョニングされるインフラストラクチャーにインストールするには、マシンとサポートするインフラストラクチャーの両方を手動で作成する必要があります。

各種プラットフォームの統合テストの詳細については、「 OpenShift Container Platform 4.x Tested Integrations」のページを参照してください。

提供される CloudFormation テンプレートを使用してこのインフラストラクチャーを作成でき、コンポーネントを手動で作成するか、またはクラスターの要件を満たす既存のインフラストラクチャーを再利用できます。コンポーネントの相互関係についての詳細は、CloudFormation テンプレートを参照してください。

1.6.3.1. クラスターマシン

以下のマシンには AWS::EC2::Instance オブジェクトが必要になります。

  • ブートストラップマシン。このマシンはインストール時に必要ですが、クラスターのデプロイ後に除去することができます。
  • 3 つ以上のコントロールプレーンマシン。コントロールプレーンマシンは MachineSet によって制御されません。
  • コンピュートマシン。インストール時に 2 つ以上のコンピュートマシン (ワーカーマシンとしても知られる) を作成する必要があります。これらのマシンは MachineSet によって制御されません。

提供される CloudFormation テンプレートを使用して、クラスターマシンの以下のインスタンスタイプを使用できます。

重要

m4 インスタンスが eu-west-3 などのリージョンで利用可能ではない場合、m5 タイプを代わりに使用します。

表1.10 マシンのインスタンスタイプ

インスタンスタイプブートストラップコントロールプレーンコンピュート

i3.large

x

  

m4.large または m5.large

  

x

m4.xlarge または m5.xlarge

 

x

x

m4.2xlarge

 

x

x

m4.4xlarge

 

x

x

m4.8xlarge

 

x

x

m4.10xlarge

 

x

x

m4.16xlarge

 

x

x

c4.large

  

x

c4.xlarge

  

x

c4.2xlarge

 

x

x

c4.4xlarge

 

x

x

c4.8xlarge

 

x

x

r4.large

  

x

r4.xlarge

 

x

x

r4.2xlarge

 

x

x

r4.4xlarge

 

x

x

r4.8xlarge

 

x

x

r4.16xlarge

 

x

x

これらのインスタンスタイプの仕様に対応する他のインスタンスタイプを使用できる場合もあります。

1.6.3.2. 証明書署名要求の管理

ユーザーがプロビジョニングするインフラストラクチャーを使用する場合、クラスターの自動マシン管理へのアクセスは制限されるため、インストール後にクラスターの証明書署名要求 (CSR) のメカニズムを提供する必要があります。kube-controller-manager は kubelet クライアント CSR のみを承認します。machine-approver は、kubelet 認証情報を使用して要求される提供証明書の有効性を保証できません。適切なマシンがこの要求を発行したかどうかを確認できないためです。kubelet 提供証明書の要求の有効性を検証し、それらを承認する方法を判別し、実装する必要があります。

1.6.3.3. 他のインフラストラクチャーコンポーネント

  • 1 つの VPC
  • DNS エントリー
  • ロードバランサー(classic または network)およびリスナー
  • パブリックおよびプライベート Route53 ゾーン
  • セキュリティーグループ
  • IAM ロール
  • S3 バケット

必要な VPC コンポーネント

お使いのマシンとの通信を可能にする適切な VPC およびサブネットを指定する必要があります。

コンポーネントAWS タイプ説明

VPC

  • AWS::EC2::VPC
  • AWS::EC2::VPCEndpoint

使用するクラスターのパブリック VPC を指定する必要があります。VPC は、各サブネットのルートテーブルを参照するエンドポイントを使用して、S3 でホストされているレジストリーとの通信を強化します。

パブリックサブネット

  • AWS::EC2::Subnet
  • AWS::EC2::SubnetNetworkAclAssociation

VPC には 1 から 3 のアベイラビリティーゾーンのパブリックサブネットが必要であり、それらを適切な Ingress ルールに関連付ける必要があります。

インターネットゲートウェイ

  • AWS::EC2::InternetGateway
  • AWS::EC2::VPCGatewayAttachment
  • AWS::EC2::RouteTable
  • AWS::EC2::Route
  • AWS::EC2::SubnetRouteTableAssociation
  • AWS::EC2::NatGateway
  • AWS::EC2::EIP

VPC に割り当てられたパブリックルートを持つパブリックインターネットゲートウェイが必要です。提供されるテンプレートでは、各パブリックサブネットに EIP アドレスと NAT ゲートウェイがあります。これらの NAT ゲートウェイは、プライベートサブネットインスタンスなどのクラスターリソースがインターネットに到達できるようにするもので、一部のネットワークが制限された環境またはプロキシーのシナリオでは必要ありません。

ネットワークアクセス制御

  • AWS::EC2::NetworkAcl
  • AWS::EC2::NetworkAclEntry

VPC が以下のポートにアクセスできるようにする必要があります。

ポート

理由

80

インバウンド HTTP トラフィック

443

インバウンド HTTPS トラフィック

22

インバウンド SSH トラフィック

1024 - 65535

インバウンド一時 (ephemeral) トラフィック

0 - 65535

アウトバウンド一時 (ephemeral) トラフィック

プライベートサブネット

  • AWS::EC2::Subnet
  • AWS::EC2::RouteTable
  • AWS::EC2::SubnetRouteTableAssociation

VPC にはプライベートサブネットを使用できます。提供される CloudFormation テンプレートは 1 から 3 アベイラビリティーゾーンのプライベートサブネットを作成できます。プライベートサブネットを使用できる場合は、それらの適切なルートおよびテーブルを指定する必要があります。

必要な DNS および負荷分散コンポーネント

DNS およびロードバランサー設定では、パブリックホストゾーンを使用する必要があり、クラスターのインフラストラクチャーをプロビジョニングする場合にインストールプログラムが使用するものと同様のプライベートホストゾーンを使用できます。ロードバランサーに解決する DNS エントリーを作成する必要があります。api.<cluster_name>.<domain> のエントリーは外部ロードバランサーを参照し、api-int.<cluster_name>.<domain> のエントリーは内部ロードバランサーを参照する必要があります。

またクラスターには、Kubernetes API とその拡張に必要なポート 6443、および新規マシンの Ignition 設定ファイルに必要なポート 22623 のロードバランサーおよびリスナーが必要です。ターゲットはマスターノードになります。ポート 6443 はクラスター外のクライアントとクラスター内のノードからもアクセスできる必要があります。ポート 22623 はクラスター内のノードからアクセスできる必要があります。

コンポーネントAWS タイプ説明

DNS

AWS::Route53::HostedZone

内部 DNS のホストゾーン。

etcd レコードセット

AWS::Route53::RecordSet

コントロールプレーンマシンの etcd の登録レコード。

パブリックロードバランサー

AWS::ElasticLoadBalancingV2::LoadBalancer

パブリックサブネットのロードバランサー。

外部 API サーバーレコード

AWS::Route53::RecordSetGroup

外部 API サーバーのエイリアスレコード。

外部リスナー

AWS::ElasticLoadBalancingV2::Listener

外部ロードバランサー用のポート 6443 のリスナー。

外部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

外部ロードバランサーのターゲットグループ。

プライベートロードバランサー

AWS::ElasticLoadBalancingV2::LoadBalancer

プライベートサブネットのロードバランサー。

内部 API サーバーレコード

AWS::Route53::RecordSetGroup

内部 API サーバーのエイリアスレコード。

内部リスナー

AWS::ElasticLoadBalancingV2::Listener

内部ロードバランサー用のポート 22623 のリスナー。

内部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

内部ロードバランサーのターゲットグループ。

内部リスナー

AWS::ElasticLoadBalancingV2::Listener

内部ロードバランサーのポート 6443 のリスナー。

内部ターゲットグループ

AWS::ElasticLoadBalancingV2::TargetGroup

内部ロードバランサーのターゲットグループ。

セキュリティーグループ

コントロールプレーンおよびワーカーマシンには、以下のポートへのアクセスが必要です。

グループタイプIP プロトコルポート範囲

MasterSecurityGroup

AWS::EC2::SecurityGroup

icmp

0

tcp

22

tcp

6443

tcp

22623

WorkerSecurityGroup

AWS::EC2::SecurityGroup

icmp

0

tcp

22

BootstrapSecurityGroup

AWS::EC2::SecurityGroup

tcp

22

tcp

19531

コントロールプレーンの Ingress

コントロールプレーンマシンには、以下の Ingress グループが必要です。それぞれの Ingress グループは AWS::EC2::SecurityGroupIngress リソースになります。

Ingress グループ説明IP プロトコルポート範囲

MasterIngressEtcd

etcd

tcp

2379- 2380

MasterIngressVxlan

Vxlan パケット

udp

4789

MasterIngressWorkerVxlan

Vxlan パケット

udp

4789

MasterIngressInternal

内部クラスター通信および Kubernetes プロキシーメトリクス

tcp

9000 - 9999

MasterIngressWorkerInternal

内部クラスター通信

tcp

9000 - 9999

MasterIngressKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250 - 10259

MasterIngressWorkerKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250 - 10259

MasterIngressIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

MasterIngressWorkerIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

ワーカーの Ingress

ワーカーマシンには、以下の Ingress グループが必要です。それぞれの Ingress グループは AWS::EC2::SecurityGroupIngress リソースになります。

Ingress グループ説明IP プロトコルポート範囲

WorkerIngressVxlan

Vxlan パケット

udp

4789

WorkerIngressWorkerVxlan

Vxlan パケット

udp

4789

WorkerIngressInternal

内部クラスター通信

tcp

9000 - 9999

WorkerIngressWorkerInternal

内部クラスター通信

tcp

9000 - 9999

WorkerIngressKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250

WorkerIngressWorkerKube

Kubernetes kubelet、スケジューラーおよびコントローラーマネージャー

tcp

10250

WorkerIngressIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

WorkerIngressWorkerIngressServices

Kubernetes Ingress サービス

tcp

30000 - 32767

ロールおよびインスタンスプロファイル

マシンには、AWS でのパーミッションを付与する必要があります。提供される CloudFormation テンプレートはマシンに対し、以下の AWS::IAM::Role オブジェクトについてのパーミッションを付与し、それぞれのロールセットに AWS::IAM::InstanceProfile を指定します。テンプレートを使用しない場合、マシンには以下の広範囲のパーミッションまたは個別のパーミッションを付与することができます。

ロール結果アクションリソース

マスター

Allow

ec2:*

*

Allow

elasticloadbalancing:*

*

Allow

iam:PassRole

*

Allow

s3:GetObject

*

ワーカー

Allow

ec2:Describe*

*

ブートストラップ

Allow

ec2:Describe*

*

Allow

ec2:AttachVolume

*

Allow

ec2:DetachVolume

*

1.6.3.4. 必要な AWS パーミッション

AdministratorAccess ポリシーを、作成する IAM ユーザーに割り当てる場合、そのユーザーには必要なパーミッションすべてを付与します。OpenShift Container Platform クラスターをデプロイするために、IAM ユーザーに以下のパーミッションが必要になります。

インストールに必要な EC2 パーミッション

  • ec2:AllocateAddress
  • ec2:AssociateAddress
  • ec2:AssociateDhcpOptions
  • ec2:AssociateRouteTable
  • ec2:AttachInternetGateway
  • ec2:AuthorizeSecurityGroupEgress
  • ec2:AuthorizeSecurityGroupIngress
  • ec2:CopyImage
  • ec2:CreateDhcpOptions
  • ec2:CreateInternetGateway
  • ec2:CreateNatGateway
  • ec2:CreateNetworkInterface
  • ec2:CreateRoute
  • ec2:CreateRouteTable
  • ec2:CreateSecurityGroup
  • ec2:CreateSubnet
  • ec2:CreateTags
  • ec2:CreateVpc
  • ec2:CreateVpcEndpoint
  • ec2:CreateVolume
  • ec2:DeleteSnapshot
  • ec2:DeregisterImage
  • ec2:DescribeAccountAttributes
  • ec2:DescribeAddresses
  • ec2:DescribeAvailabilityZones
  • ec2:DescribeDhcpOptions
  • ec2:DescribeImages
  • ec2:DescribeInstanceAttribute
  • ec2:DescribeInstanceCreditSpecifications
  • ec2:DescribeInstances
  • ec2:DescribeInternetGateways
  • ec2:DescribeKeyPairs
  • ec2:DescribeNatGateways
  • ec2:DescribeNetworkAcls
  • ec2:DescribePrefixLists
  • ec2:DescribeRegions
  • ec2:DescribeRouteTables
  • ec2:DescribeSecurityGroups
  • ec2:DescribeSubnets
  • ec2:DescribeTags
  • ec2:DescribeVpcEndpoints
  • ec2:DescribeVpcs
  • ec2:DescribeVpcAttribute
  • ec2:DescribeVolumes
  • ec2:DescribeVpcClassicLink
  • ec2:DescribeVpcClassicLinkDnsSupport
  • ec2:ModifyInstanceAttribute
  • ec2:ModifySubnetAttribute
  • ec2:ModifyVpcAttribute
  • ec2:RevokeSecurityGroupEgress
  • ec2:RunInstances
  • ec2:TerminateInstances
  • ec2:DeleteDhcpOptions
  • ec2:DeleteRoute
  • ec2:RevokeSecurityGroupIngress
  • ec2:DisassociateRouteTable
  • ec2:ReplaceRouteTableAssociation
  • ec2:DeleteRouteTable
  • ec2:DeleteSubnet
  • ec2:DescribeNetworkInterfaces
  • ec2:ModifyNetworkInterfaceAttribute
  • ec2:DeleteNatGateway
  • ec2:DeleteSecurityGroup
  • ec2:DetachInternetGateway
  • ec2:DeleteInternetGateway
  • ec2:ReleaseAddress
  • ec2:DeleteVpc

インストールに必要な Elasticloadbalancing パーミッション

  • elasticloadbalancing:AddTags
  • elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
  • elasticloadbalancing:AttachLoadBalancerToSubnets
  • elasticloadbalancing:CreateListener
  • elasticloadbalancing:CreateLoadBalancer
  • elasticloadbalancing:CreateLoadBalancerListeners
  • elasticloadbalancing:CreateTargetGroup
  • elasticloadbalancing:ConfigureHealthCheck
  • elasticloadbalancing:DeleteLoadBalancer
  • elasticloadbalancing:DeregisterInstancesFromLoadBalancer
  • elasticloadbalancing:DeregisterTargets
  • elasticloadbalancing:DescribeInstanceHealth
  • elasticloadbalancing:DescribeListeners
  • elasticloadbalancing:DescribeLoadBalancers
  • elasticloadbalancing:DescribeLoadBalancerAttributes
  • elasticloadbalancing:DescribeTags
  • elasticloadbalancing:DescribeTargetGroupAttributes
  • elasticloadbalancing:DescribeTargetHealth
  • elasticloadbalancing:ModifyLoadBalancerAttributes
  • elasticloadbalancing:ModifyTargetGroup
  • elasticloadbalancing:ModifyTargetGroupAttributes
  • elasticloadbalancing:RegisterTargets
  • elasticloadbalancing:RegisterInstancesWithLoadBalancer
  • elasticloadbalancing:SetLoadBalancerPoliciesOfListener

インストールに必要な IAM パーミッション

  • iam:AddRoleToInstanceProfile
  • iam:CreateInstanceProfile
  • iam:CreateRole
  • iam:DeleteInstanceProfile
  • iam:DeleteRole
  • iam:DeleteRolePolicy
  • iam:GetInstanceProfile
  • iam:GetRole
  • iam:GetRolePolicy
  • iam:GetUser
  • iam:ListInstanceProfilesForRole
  • iam:ListRoles
  • iam:ListUsers
  • iam:PassRole
  • iam:PutRolePolicy
  • iam:RemoveRoleFromInstanceProfile
  • iam:SimulatePrincipalPolicy
  • iam:TagRole

インストールに必要な Route53 パーミッション

  • route53:ChangeResourceRecordSets
  • route53:ChangeTagsForResource
  • route53:GetChange
  • route53:GetHostedZone
  • route53:CreateHostedZone
  • route53:DeleteHostedZone
  • route53:ListHostedZones
  • route53:ListHostedZonesByName
  • route53:ListResourceRecordSets
  • route53:ListTagsForResource
  • route53:UpdateHostedZoneComment

インストールに必要な S3 パーミッション

  • s3:CreateBucket
  • s3:DeleteBucket
  • s3:GetAccelerateConfiguration
  • s3:GetBucketCors
  • s3:GetBucketLocation
  • s3:GetBucketLogging
  • s3:GetBucketObjectLockConfiguration
  • s3:GetBucketReplication
  • s3:GetBucketRequestPayment
  • s3:GetBucketTagging
  • s3:GetBucketVersioning
  • s3:GetBucketWebsite
  • s3:GetEncryptionConfiguration
  • s3:GetLifecycleConfiguration
  • s3:GetReplicationConfiguration
  • s3:ListBucket
  • s3:PutBucketAcl
  • s3:PutBucketTagging
  • s3:PutEncryptionConfiguration

クラスター Operator が必要とする S3 パーミッション

  • s3:PutObject
  • s3:PutObjectAcl
  • s3:PutObjectTagging
  • s3:GetObject
  • s3:GetObjectAcl
  • s3:GetObjectTagging
  • s3:GetObjectVersion
  • s3:DeleteObject

クラスターのアンインストールに必要な追加のすべてのパーミッション

  • autoscaling:DescribeAutoScalingGroups
  • ec2:DeleteNetworkInterface
  • ec2:DeleteVolume
  • ec2:DeleteVpcEndpoints
  • elasticloadbalancing:DescribeTargetGroups
  • elasticloadbalancing:DeleteTargetGroup
  • iam:ListInstanceProfiles
  • iam:ListRolePolicies
  • iam:ListUserPolicies
  • tag:GetResources

マニフェストの作成に必要な追加の IAM および S3 パーミッション

  • iam:CreateAccessKey
  • iam:CreateUser
  • iam:DeleteAccessKey
  • iam:DeleteUser
  • iam:DeleteUserPolicy
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • iam:PutUserPolicy
  • iam:TagUser
  • iam:GetUserPolicy
  • iam:ListAccessKeys
  • s3:PutBucketPublicAccessBlock
  • s3:GetBucketPublicAccessBlock
  • s3:PutLifecycleConfiguration
  • s3:HeadBucket
  • s3:ListBucketMultipartUploads
  • s3:AbortMultipartUpload

1.6.4. SSH プライベートキーの生成およびエージェントへの追加

クラスターでインストールのデバッグまたは障害復旧を実行する必要がある場合、ssh-agent とインストールプログラムの両方に SSH キーを指定する必要があります。

注記

実稼働環境では、障害復旧およびデバッグが必要です。

このキーを使用して、ユーザー core としてマスターノードに対して SSH を実行できます。クラスターをデプロイする際に、キーは core ユーザーの ~/.ssh/authorized_keys 一覧に追加されます。

注記

AWS キーペアなどのプラットフォームに固有の方法で設定したキーではなく、ローカルキーを使用する必要があります。

手順

  1. パスワードなしの認証に設定されている SSH キーがコンピューター上にない場合は、これを作成します。たとえば、Linux オペレーティングシステムを使用するコンピューターで以下のコマンドを実行します。

    $ ssh-keygen -t rsa -b 4096 -N '' \
        -f <path>/<file_name> 1
    1
    ~/.ssh/id_rsa などの、SSH キーのパスおよびファイル名を指定します。

    このコマンドを実行すると、指定した場所にパスワードを必要としない SSH キーが生成されます。

  2. ssh-agent プロセスをバックグラウンドタスクとして開始します。

    $ eval "$(ssh-agent -s)"
    
    Agent pid 31874
  3. SSH プライベートキーを ssh-agent に追加します。

    $ ssh-add <path>/<file_name> 1
    
    Identity added: /home/<you>/<path>/<file_name> (<computer_name>)
    1
    ~/.ssh/id_rsa などの、SSH プライベートキーのパスおよびファイル名を指定します。

次のステップ

  • OpenShift Container Platform をインストールする際に、SSH パブリックキーをインストールプログラムに指定します。クラスターを独自にプロビジョニングするインフラストラクチャーにインストールする場合は、このキーをクラスターのマシンに指定する必要があります。

1.6.5. AWS のインストール設定ファイルの作成

ユーザーによってプロビジョニングされるインフラストラクチャー を使用して OpenShift Container Platform を Amazon Web Services (AWS) にインストールするには、インストールプログラムがクラスターをデプロイするために必要なファイルを生成し、クラスターが使用するマシンのみを作成するようにそれらのファイルを変更する必要があります。install-config.yaml ファイル、Kubernetes マニフェスト、および Ignition 設定ファイルを生成し、カスタマイズします。

1.6.5.1. インストール設定ファイルの作成

インストールプログラムがクラスターをデプロイするために必要なインストール設定ファイルを生成し、カスタマイズします。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。ネットワークが制限されたインストールでは、これらのファイルが bastion ホスト上に置かれます。

手順

  1. install-config.yaml ファイルを取得します。

    1. 次のコマンドを実行します。

      $ ./openshift-install create install-config --dir=<installation_directory> 1
      1
      <installation_directory> には、インストールプログラムが作成するファイルを保存するためにディレクトリー名を指定します。
      重要

      空のディレクトリーを指定します。ブートストラップ X.509 証明書などの一部のインストールアセットの有効期限は短く設定されているため、インストールディレクトリーを再利用することができません。別のクラスターインストールの個別のファイルを再利用する必要がある場合は、それらをディレクトリーにコピーすることができます。ただし、インストールアセットのファイル名はリリース間で変更される可能性があります。インストールファイルを以前のバージョンの OpenShift Container Platform からコピーする場合は注意してコピーを行ってください。

    2. プロンプト時に、クラウドの設定の詳細情報を指定します。

      1. オプション: クラスターマシンにアクセスするために使用する SSH キーを選択します。

        注記

        インストールのデバッグまたは障害復旧を実行する必要のある実稼働用の OpenShift Container Platform クラスターでは、ssh-agent プロセスが使用する SSH キーを指定します。

      2. ターゲットに設定するプラットフォームとして aws を選択します。
      3. AWS プロファイルをコンピューターに保存していない場合、インストールプログラムを実行するように設定したユーザーの AWS アクセスキー ID およびシークレットアクセスキーを入力します。
      4. クラスターのデプロイ先とする AWS リージョンを選択します。
      5. クラスターに設定した Route53 サービスのベースドメインを選択します。
      6. クラスターの記述名を入力します。
      7. Red Hat OpenShift Cluster Manager サイトの「Pull Secret」ページから取得したプルシークレットを貼り付けます。
  2. install-config.yaml ファイルを編集し、以下の compute スタンザに示されるようにコンピュートレプリカ (ワーカーレプリカとしても知られる) の数を 0 に設定します。

    compute:
    - hyperthreading: Enabled
      name: worker
      platform: {}
      replicas: 0
  3. install-config.yaml ファイルを編集し、ネットワークが制限された環境でのインストールに必要な追加の情報を提供します。

    1. pullSecret の値を更新して、レジストリーの認証情報を追加します。

      pullSecret: '{"auths":{"<bastion_host_name>:5000": {"auth": "<credentials>","email": "you@example.com"}}}'

      bastion_host_nameの場合、ミラーレジストリーの証明書で指定したレジストリードメイン名を指定し、<credentials> の場合は、ミラーレジストリーの base64 でエンコードされたユーザー名およびパスワードを指定します。

    2. additionalTrustBundle パラメーターおよび値を追加します。この値は、ミラーレジストリーに使用した証明書ファイルの内容である必要があります。これはミラーレジストリー用に生成した既存の、信頼される認証局または自己署名証明書である可能性があります。

      additionalTrustBundle: |
        -----BEGIN CERTIFICATE-----
        ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
        -----END CERTIFICATE-----
    3. イメージコンテンツリソースを追加します。

      imageContentSources:
      - mirrors:
        - <bastion_host_name>:5000/<repo_name>/release
        source: quay.io/openshift-release-dev/ocp-release
      - mirrors:
        - <bastion_host_name>:5000/<repo_name>/release
        source: registry.svc.ci.openshift.org/ocp/release

      リポジトリーをミラーリングするには、コマンドの出力の imageContentSources セクションを使用します。

  4. オプション: install-config.yaml ファイルをバックアップします。

    重要

    install-config.yaml ファイルはインストールプロセス時に使用されます。このファイルを再利用する必要がある場合は、この段階でこれをバックアップしてください。

1.6.5.2. インストール時のクラスター全体のプロキシーの設定

実稼働環境では、インターネットへの直接アクセスを拒否し、代わりに HTTP または HTTPS プロキシーを使用することができます。プロキシー設定を install-config.yaml ファイルで行うことにより、新規の OpenShift Container Platform クラスターをプロキシーを使用するように設定できます。

前提条件

  • 既存の install-config.yaml ファイル。
  • クラスターがアクセスする必要のあるサイトを確認し、プロキシーをバイパスする必要があるかどうかを判別する。デフォルトで、すべてのクラスター egress トラフィック (クラスターをホストするクラウドについてのクラウドプロバイダー API に対する呼び出しを含む) はプロキシーされます。プロキシーオブジェクトの spec.noProxy フィールドにサイトを追加し、必要に応じてプロキシーをバイパスします。

    注記

    プロキシーオブジェクトの status.noProxy フィールドは、デフォルトでインスタンスメタデータエンドポイント (169.254.169.254) およびインストール設定の networking.machineCIDRnetworking.clusterNetwork.cidr、および networking.serviceNetwork フィールドの値で設定されます。

手順

  1. install-config.yaml ファイルを編集し、プロキシー設定を追加します。以下は例になります。

    apiVersion: v1
    baseDomain: my.domain.com
    proxy:
      httpProxy: http://<username>:<pswd>@<ip>:<port> 1
      httpsProxy: http://<username>:<pswd>@<ip>:<port> 2
      noProxy: example.com 3
    additionalTrustBundle: | 4
        -----BEGIN CERTIFICATE-----
        <MY_TRUSTED_CA_CERT>
        -----END CERTIFICATE-----
    ...
    1
    クラスター外の HTTP 接続を作成するために使用するプロキシー URL。URL スキームは httpである必要があります。
    2
    クラスター外で HTTPS 接続を作成するために使用するプロキシー URL。このフィールドが指定されていない場合、HTTP および HTTPS 接続の両方に httpProxy が使用されます。URL スキームは http である必要があります。 https は現在サポートされていません。
    3
    プロキシーを除外するための宛先ドメイン名、ドメイン、IP アドレス、または他のネットワーク CIDR のカンマ区切りの一覧。ドメインのすべてのサブドメインを組み込むために、ドメインの前に . を入力します。* を使用し、すべての宛先のプロキシーをバイパスします。
    4
    指定されている場合、インストールプログラムは HTTPS 接続のプロキシーに必要な 1 つ以上の追加の CA 証明書が含まれる user-ca-bundle という名前の ConfigMap を openshift-config namespace に生成します。次に、Cluster Network Operator は 3 つのコンテンツを Red Hat Enterprise Linux CoreOS (RHCOS) 信頼バンドルにマージする trusted-ca-bundle ConfigMap を作成し、この ConfigMap はプロキシーオブジェクトの trustedCA フィールドで参照されます。additionalTrustBundle フィールドは、プロキシーのアイデンティティー証明書が RHCOS 信頼バンドルからの認証局によって署名されない限り必要になります。
    注記

    インストールプログラムは、プロキシーの readinessEndpoints フィールドをサポートしません。

  2. ファイルを保存し、OpenShift Container Platform のインストール時にこれを参照します。

インストールプログラムは、指定の install-config.yaml ファイルのプロキシー設定を使用する cluster という名前のクラスター全体のプロキシーを作成します。プロキシー設定が指定されていない場合、 cluster のプロキシーオブジェクトが依然として作成されますが、これには spec がありません。

注記

cluster という名前のプロキシーオブジェクトのみがサポートされ、追加のプロキシーを作成することはできません。

1.6.5.3. Kubernetes マニフェストおよび Ignition 設定ファイルの作成

一部のクラスター定義ファイルを変更し、クラスターマシンを手動で起動する必要があるため、クラスターがマシンを作成するために必要な Kubernetes マニフェストと Ignition 設定ファイルを生成する必要があります。

重要

インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターのインストールを完了し、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

前提条件

  • OpenShift Container Platform インストールプログラムを取得します。ネットワークが制限されたインストールでは、これらのファイルが bastion ホスト上に置かれます。
  • install-config.yaml インストール設定ファイルを作成します。

手順

  1. クラスターの Kubernetes マニフェストを生成します。

    $ ./openshift-install create manifests --dir=<installation_directory> 1
    
    WARNING There are no compute nodes specified. The cluster will not fully initialize without compute nodes.
    INFO Consuming "Install Config" from target directory
    1
    <installation_directory> については、作成した install-config.yaml ファイルが含まれるインストールディレクトリーを指定します。

    インストールプロセスの後の部分で独自のコンピュートマシンを作成するため、この警告を無視しても問題がありません。

  2. コントロールプレーンマシンを定義する Kubernetes マニフェストファイルを削除します。

    $ rm -f openshift/99_openshift-cluster-api_master-machines-*.yaml

    これらのファイルを削除することで、クラスターがコントロールプレーンマシンを自動的に生成するのを防ぐことができます。

  3. ワーカーマシンを定義する Kubernetes マニフェストファイルを削除します。

    $ rm -f openshift/99_openshift-cluster-api_worker-machineset-*.yaml

    ワーカーマシンは独自に作成し、管理するため、これらのマシンを初期化する必要はありません。

  4. manifests/cluster-scheduler-02-config.yml Kubernetes マニフェストファイルを変更し、Pod がコントロールプレーンマシンにスケジュールされないようにします。

    1. manifests/cluster-scheduler-02-config.yml ファイルを開きます。
    2. mastersSchedulable パラメーターを見つけ、その値を False に設定します。
    3. ファイルを保存し、終了します。
    注記

    現時点では、Kubernetes の制限により、コントロールプレーンマシンで実行されるルーター Pod に Ingress ロードバランサーがアクセスすることができません。この手順は、OpenShift Container Platform の今後のマイナーバージョンで不要になる可能性があります。

  5. オプション: Ingress Operator を DNS レコードを作成するよう設定する必要がない場合は、manifests/cluster-dns-02-config.yml DNS 設定ファイルから privateZone および publicZone セクションを削除します。

    apiVersion: config.openshift.io/v1
    kind: DNS
    metadata:
      creationTimestamp: null
      name: cluster
    spec:
      baseDomain: example.openshift.com
      privateZone: 1
        id: mycluster-100419-private-zone
      publicZone: 2
        id: example.openshift.com
    status: {}
    1 2
    これらのセクションを完全に削除します。

    これを実行する場合、後のステップで Ingress DNS レコードを手動で追加する必要があります。

  6. Ignition 設定ファイルを取得します。

    $ ./openshift-install create ignition-configs --dir=<installation_directory> 1
    1
    <installation_directory> については、同じインストールディレクトリーを指定します。

    以下のファイルはディレクトリーに生成されます。

    .
    ├── auth
    │   ├── kubeadmin-password
    │   └── kubeconfig
    ├── bootstrap.ign
    ├── master.ign
    ├── metadata.json
    └── worker.ign

1.6.6. インフラストラクチャー名の抽出

Ignition 設定には、Amazon Web Services (AWS) でクラスターを一意に識別するために使用できる一意のクラスター ID が含まれます。提供される CloudFormation テンプレートにはこのインフラストラクチャー名の参照が含まれるため、これを抽出する必要があります。

前提条件

  • OpenShift Container Platform インストールプログラム、およびクラスターのプルシークレットを取得します。
  • クラスターの Ignition 設定ファイルを生成します。
  • jq パッケージのインストール。

手順

  • Ignition 設定ファイルメタデータからインフラストラクチャー名を抽出し、表示するには、以下のコマンドを実行します。

    $ jq -r .infraID /<installation_directory>/metadata.json 1
    openshift-vw9j6 2
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    2
    このコマンドの出力はクラスター名とランダムな文字列になります。

1.6.7. AWS での VPC の作成

OpenShift Container Platform クラスターで使用する VPC を Amazon Web Services (AWS) で作成する必要があります。VPN およびルートテーブルを含む、各種要件を満たすように VPC をカスタマイズできます。VPC を作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "VpcCidr", 1
        "ParameterValue": "10.0.0.0/16" 2
      },
      {
        "ParameterKey": "AvailabilityZoneCount", 3
        "ParameterValue": "1" 4
      },
      {
        "ParameterKey": "SubnetBits", 5
        "ParameterValue": "12" 6
      }
    ]
    1
    VPC の CIDR ブロック。
    2
    x.x.x.x/16-24 形式で CIDR ブロックを指定します。
    3
    VPC をデプロイするアベイラビリティーゾーンの数。
    4
    1 から 3 の間の整数を指定します。
    5
    各アベイラビリティーゾーン内の各サブネットのサイズ。
    6
    5 から 13 の間の整数を指定します。 ここで、5/27 であり、 13/19 です。
  2. このトピックの「VPC の CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要な VPC について記述しています。
  3. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
    1
    <name>cluster-vpc などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  4. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    VpcId

    VPC の ID。

    PublicSubnetIds

    新規パブリックサブネットの ID。

    PrivateSubnetIds

    新規プライベートサブネットの ID。

1.6.7.1. VPC の CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要な VPC をデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for Best Practice VPC with 1-3 AZs

Parameters:
  VpcCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    Default: 10.0.0.0/16
    Description: CIDR block for VPC.
    Type: String
  AvailabilityZoneCount:
    ConstraintDescription: "The number of availability zones. (Min: 1, Max: 3)"
    MinValue: 1
    MaxValue: 3
    Default: 1
    Description: "How many AZs to create VPC subnets for. (Min: 1, Max: 3)"
    Type: Number
  SubnetBits:
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/19-27.
    MinValue: 5
    MaxValue: 13
    Default: 12
    Description: "Size of each subnet to create within the availability zones. (Min: 5 = /27, Max: 13 = /19)"
    Type: Number

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcCidr
      - SubnetBits
    - Label:
        default: "Availability Zones"
      Parameters:
      - AvailabilityZoneCount
    ParameterLabels:
      AvailabilityZoneCount:
        default: "Availability Zone Count"
      VpcCidr:
        default: "VPC CIDR"
      SubnetBits:
        default: "Bits Per Subnet"

Conditions:
  DoAz3: !Equals [3, !Ref AvailabilityZoneCount]
  DoAz2: !Or [!Equals [2, !Ref AvailabilityZoneCount], Condition: DoAz3]

Resources:
  VPC:
    Type: "AWS::EC2::VPC"
    Properties:
      EnableDnsSupport: "true"
      EnableDnsHostnames: "true"
      CidrBlock: !Ref VpcCidr
  PublicSubnet:
    Type: "AWS::EC2::Subnet"
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [0, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 0
      - Fn::GetAZs: !Ref "AWS::Region"
  PublicSubnet2:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [1, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 1
      - Fn::GetAZs: !Ref "AWS::Region"
  PublicSubnet3:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [2, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 2
      - Fn::GetAZs: !Ref "AWS::Region"
  InternetGateway:
    Type: "AWS::EC2::InternetGateway"
  GatewayToInternet:
    Type: "AWS::EC2::VPCGatewayAttachment"
    Properties:
      VpcId: !Ref VPC
      InternetGatewayId: !Ref InternetGateway
  PublicRouteTable:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
  PublicRoute:
    Type: "AWS::EC2::Route"
    DependsOn: GatewayToInternet
    Properties:
      RouteTableId: !Ref PublicRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId: !Ref InternetGateway
  PublicSubnetRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet
      RouteTableId: !Ref PublicRouteTable
  PublicSubnetRouteTableAssociation2:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz2
    Properties:
      SubnetId: !Ref PublicSubnet2
      RouteTableId: !Ref PublicRouteTable
  PublicSubnetRouteTableAssociation3:
    Condition: DoAz3
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet3
      RouteTableId: !Ref PublicRouteTable
  PrivateSubnet:
    Type: "AWS::EC2::Subnet"
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [3, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 0
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable:
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PrivateSubnet
      RouteTableId: !Ref PrivateRouteTable
  NAT:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP
        - AllocationId
      SubnetId: !Ref PublicSubnet
  EIP:
    Type: "AWS::EC2::EIP"
    Properties:
      Domain: vpc
  Route:
    Type: "AWS::EC2::Route"
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT
  PrivateSubnet2:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [4, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 1
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable2:
    Type: "AWS::EC2::RouteTable"
    Condition: DoAz2
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation2:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz2
    Properties:
      SubnetId: !Ref PrivateSubnet2
      RouteTableId: !Ref PrivateRouteTable2
  NAT2:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Condition: DoAz2
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP2
        - AllocationId
      SubnetId: !Ref PublicSubnet2
  EIP2:
    Type: "AWS::EC2::EIP"
    Condition: DoAz2
    Properties:
      Domain: vpc
  Route2:
    Type: "AWS::EC2::Route"
    Condition: DoAz2
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable2
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT2
  PrivateSubnet3:
    Type: "AWS::EC2::Subnet"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
      CidrBlock: !Select [5, !Cidr [!Ref VpcCidr, 6, !Ref SubnetBits]]
      AvailabilityZone: !Select
      - 2
      - Fn::GetAZs: !Ref "AWS::Region"
  PrivateRouteTable3:
    Type: "AWS::EC2::RouteTable"
    Condition: DoAz3
    Properties:
      VpcId: !Ref VPC
  PrivateSubnetRouteTableAssociation3:
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Condition: DoAz3
    Properties:
      SubnetId: !Ref PrivateSubnet3
      RouteTableId: !Ref PrivateRouteTable3
  NAT3:
    DependsOn:
    - GatewayToInternet
    Type: "AWS::EC2::NatGateway"
    Condition: DoAz3
    Properties:
      AllocationId:
        "Fn::GetAtt":
        - EIP3
        - AllocationId
      SubnetId: !Ref PublicSubnet3
  EIP3:
    Type: "AWS::EC2::EIP"
    Condition: DoAz3
    Properties:
      Domain: vpc
  Route3:
    Type: "AWS::EC2::Route"
    Condition: DoAz3
    Properties:
      RouteTableId:
        Ref: PrivateRouteTable3
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: NAT3
  S3Endpoint:
    Type: AWS::EC2::VPCEndpoint
    Properties:
      PolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal: '*'
          Action:
          - '*'
          Resource:
          - '*'
      RouteTableIds:
      - !Ref PublicRouteTable
      - !Ref PrivateRouteTable
      - !If [DoAz2, !Ref PrivateRouteTable2, !Ref "AWS::NoValue"]
      - !If [DoAz3, !Ref PrivateRouteTable3, !Ref "AWS::NoValue"]
      ServiceName: !Join
      - ''
      - - com.amazonaws.
        - !Ref 'AWS::Region'
        - .s3
      VpcId: !Ref VPC

Outputs:
  VpcId:
    Description: ID of the new VPC.
    Value: !Ref VPC
  PublicSubnetIds:
    Description: Subnet IDs of the public subnets.
    Value:
      !Join [
        ",",
        [!Ref PublicSubnet, !If [DoAz2, !Ref PublicSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PublicSubnet3, !Ref "AWS::NoValue"]]
      ]
  PrivateSubnetIds:
    Description: Subnet IDs of the private subnets.
    Value:
      !Join [
        ",",
        [!Ref PrivateSubnet, !If [DoAz2, !Ref PrivateSubnet2, !Ref "AWS::NoValue"], !If [DoAz3, !Ref PrivateSubnet3, !Ref "AWS::NoValue"]]
      ]

1.6.8. AWS でのネットワークおよび負荷分散コンポーネントの作成

OpenShift Container Platform クラスターで使用するネットワークおよび負荷分散 (classic または network) を Amazon Web Services (AWS) で設定する必要があります。これらのコンポーネントを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。 これにより、ホストゾーンおよびサブネットのタグも作成されます。

単一 VPC 内でテンプレートを複数回実行することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。

手順

  1. クラスターの install-config.yaml ファイルに指定した Route53 ゾーンのホストゾーン ID を取得します。この ID は、AWS コンソールから、または以下のコマンドを実行して取得できます。

    重要

    単一行にコマンドを入力してください。

    $ aws route53 list-hosted-zones-by-name |
         jq --arg name "<route53_domain>." \ 1
         -r '.HostedZones | .[] | select(.Name=="\($name)") | .Id'
    1
    <route53_domain> について、クラスターの install-config.yaml ファイルを生成した時に作成した Route53 ベースドメインを指定します。
  2. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "ClusterName", 1
        "ParameterValue": "mycluster" 2
      },
      {
        "ParameterKey": "InfrastructureName", 3
        "ParameterValue": "mycluster-<random_string>" 4
      },
      {
        "ParameterKey": "HostedZoneId", 5
        "ParameterValue": "<random_string>" 6
      },
      {
        "ParameterKey": "HostedZoneName", 7
        "ParameterValue": "example.com" 8
      },
      {
        "ParameterKey": "PublicSubnets", 9
        "ParameterValue": "subnet-<random_string>" 10
      },
      {
        "ParameterKey": "PrivateSubnets", 11
        "ParameterValue": "subnet-<random_string>" 12
      },
      {
        "ParameterKey": "VpcId", 13
        "ParameterValue": "vpc-<random_string>" 14
      }
    ]
    1
    ホスト名などに使用するクラスターを表す短いクラスターの名前。
    2
    クラスターの install-config.yaml ファイルを生成した時に使用したクラスター名を指定します。
    3
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    4
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    5
    ターゲットの登録に使用する Route53 パブリックトゾーン ID。
    6
    Z21IXYZABCZ2A4 に類する形式の Route53 パブリックゾーン ID を指定します。この値は AWS コンソールから取得できます。
    7
    ターゲットの登録に使用する Route53 ゾーン。
    8
    クラスターの install-config.yaml ファイルを生成した時に使用した Route53 ベースドメインを指定します。AWS コンソールに表示される末尾のピリド (.) は含めないでください。
    9
    VPC 用に作成したパブリックサブネット。
    10
    VPC の CloudFormation テンプレートの出力から PublicSubnetIds 値を指定します。
    11
    VPC 用に作成したプライベートサブネット。
    12
    VPC の CloudFormation テンプレートの出力から PrivateSubnetIds 値を指定します。
    13
    クラスター用に作成した VPC。
    14
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
  3. このトピックの「ネットワークおよびロードバランサーの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なネットワークおよび負荷分散オブジェクトについて記述しています。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-dns などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    PrivateHostedZoneId

    プライベート DNS のホストゾーン ID。

    ExternalApiLoadBalancerName

    外部 API ロードバランサーのフルネーム。

    InternalApiLoadBalancerName

    内部 API ロードバランサーのフルネーム。

    ApiServerDnsName

    API サーバーの完全ホスト名。

    RegisterNlbIpTargetsLambda

    これらのロードバランサーの登録/登録解除に役立つ Lambda ARN。

    ExternalApiTargetGroupArn

    外部 API ターゲットグループの ARN。

    InternalApiTargetGroupArn

    内部 API ターゲットグループの ARN。

    InternalServiceTargetGroupArn

    内部サービスターゲットグループの ARN。

1.6.8.1. ネットワークおよびロードバランサーの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なネットワークオブジェクトおよびロードバランサーをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Network Elements (Route53 & LBs)

Parameters:
  ClusterName:
    AllowedPattern: ^([a-zA-Z][a-zA-Z0-9\-]{0,26})$
    MaxLength: 27
    MinLength: 1
    ConstraintDescription: Cluster name must be alphanumeric, start with a letter, and have a maximum of 27 characters.
    Description: A short, representative cluster name to use for host names and other identifying names.
    Type: String
  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 cloud resources and identify items owned or used by the cluster.
    Type: String
  HostedZoneId:
    Description: The Route53 public zone ID to register the targets with, such as Z21IXYZABCZ2A4.
    Type: String
  HostedZoneName:
    Description: The Route53 zone to register the targets with, such as example.com. Omit the trailing period.
    Type: String
    Default: "example.com"
  PublicSubnets:
    Description: The internet-facing subnets.
    Type: List<AWS::EC2::Subnet::Id>
  PrivateSubnets:
    Description: The internal subnets.
    Type: List<AWS::EC2::Subnet::Id>
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - ClusterName
      - InfrastructureName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - PublicSubnets
      - PrivateSubnets
    - Label:
        default: "DNS"
      Parameters:
      - HostedZoneName
      - HostedZoneId
    ParameterLabels:
      ClusterName:
        default: "Cluster Name"
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      PublicSubnets:
        default: "Public Subnets"
      PrivateSubnets:
        default: "Private Subnets"
      HostedZoneName:
        default: "Public Hosted Zone Name"
      HostedZoneId:
        default: "Public Hosted Zone ID"

Resources:
  ExtApiElb:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: !Join ["-", [!Ref InfrastructureName, "ext"]]
      IpAddressType: ipv4
      Subnets: !Ref PublicSubnets
      Type: network

  IntApiElb:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      Name: !Join ["-", [!Ref InfrastructureName, "int"]]
      Scheme: internal
      IpAddressType: ipv4
      Subnets: !Ref PrivateSubnets
      Type: network

  IntDns:
    Type: "AWS::Route53::HostedZone"
    Properties:
      HostedZoneConfig:
        Comment: "Managed by CloudFormation"
      Name: !Join [".", [!Ref ClusterName, !Ref HostedZoneName]]
      HostedZoneTags:
      - Key: Name
        Value: !Join ["-", [!Ref InfrastructureName, "int"]]
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "owned"
      VPCs:
      - VPCId: !Ref VpcId
        VPCRegion: !Ref "AWS::Region"

  ExternalApiServerRecord:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      Comment: Alias record for the API server
      HostedZoneId: !Ref HostedZoneId
      RecordSets:
      - Name:
          !Join [
            ".",
            ["api", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt ExtApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt ExtApiElb.DNSName

  InternalApiServerRecord:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      Comment: Alias record for the API server
      HostedZoneId: !Ref IntDns
      RecordSets:
      - Name:
          !Join [
            ".",
            ["api", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt IntApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt IntApiElb.DNSName
      - Name:
          !Join [
            ".",
            ["api-int", !Ref ClusterName, !Join ["", [!Ref HostedZoneName, "."]]],
          ]
        Type: A
        AliasTarget:
          HostedZoneId: !GetAtt IntApiElb.CanonicalHostedZoneID
          DNSName: !GetAtt IntApiElb.DNSName

  ExternalApiListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: ExternalApiTargetGroup
      LoadBalancerArn:
        Ref: ExtApiElb
      Port: 6443
      Protocol: TCP

  ExternalApiTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 6443
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  InternalApiListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: InternalApiTargetGroup
      LoadBalancerArn:
        Ref: IntApiElb
      Port: 6443
      Protocol: TCP

  InternalApiTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 6443
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  InternalServiceInternalListener:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
      - Type: forward
        TargetGroupArn:
          Ref: InternalServiceTargetGroup
      LoadBalancerArn:
        Ref: IntApiElb
      Port: 22623
      Protocol: TCP

  InternalServiceTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 22623
      Protocol: TCP
      TargetType: ip
      VpcId:
        Ref: VpcId
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 60

  RegisterTargetLambdaIamRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Join ["-", [!Ref InfrastructureName, "nlb", "lambda", "role"]]
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "lambda.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "master", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref InternalApiTargetGroup
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref InternalServiceTargetGroup
          - Effect: "Allow"
            Action:
              [
                "elasticloadbalancing:RegisterTargets",
                "elasticloadbalancing:DeregisterTargets",
              ]
            Resource: !Ref ExternalApiTargetGroup

  RegisterNlbIpTargets:
    Type: "AWS::Lambda::Function"
    Properties:
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
        - "RegisterTargetLambdaIamRole"
        - "Arn"
      Code:
        ZipFile: |
          import json
          import boto3
          import cfnresponse
          def handler(event, context):
            elb = boto3.client('elbv2')
            if event['RequestType'] == 'Delete':
              elb.deregister_targets(TargetGroupArn=event['ResourceProperties']['TargetArn'],Targets=[{'Id': event['ResourceProperties']['TargetIp']}])
            elif event['RequestType'] == 'Create':
              elb.register_targets(TargetGroupArn=event['ResourceProperties']['TargetArn'],Targets=[{'Id': event['ResourceProperties']['TargetIp']}])
            responseData = {}
            cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, event['ResourceProperties']['TargetArn']+event['ResourceProperties']['TargetIp'])
      Runtime: "python3.7"
      Timeout: 120

  RegisterSubnetTagsLambdaIamRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Join ["-", [!Ref InfrastructureName, "subnet-tags-lambda-role"]]
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "lambda.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "subnet-tagging-policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action:
              [
                "ec2:DeleteTags",
                "ec2:CreateTags"
              ]
            Resource: "arn:aws:ec2:*:*:subnet/*"
          - Effect: "Allow"
            Action:
              [
                "ec2:DescribeSubnets",
                "ec2:DescribeTags"
              ]
            Resource: "*"

  RegisterSubnetTags:
    Type: "AWS::Lambda::Function"
    Properties:
      Handler: "index.handler"
      Role:
        Fn::GetAtt:
        - "RegisterSubnetTagsLambdaIamRole"
        - "Arn"
      Code:
        ZipFile: |
          import json
          import boto3
          import cfnresponse
          def handler(event, context):
            ec2_client = boto3.client('ec2')
            if event['RequestType'] == 'Delete':
              for subnet_id in event['ResourceProperties']['Subnets']:
                ec2_client.delete_tags(Resources=[subnet_id], Tags=[{'Key': 'kubernetes.io/cluster/' + event['ResourceProperties']['InfrastructureName']}]);
            elif event['RequestType'] == 'Create':
              for subnet_id in event['ResourceProperties']['Subnets']:
                ec2_client.create_tags(Resources=[subnet_id], Tags=[{'Key': 'kubernetes.io/cluster/' + event['ResourceProperties']['InfrastructureName'], 'Value': 'shared'}]);
            responseData = {}
            cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData, event['ResourceProperties']['InfrastructureName']+event['ResourceProperties']['Subnets'][0])
      Runtime: "python3.7"
      Timeout: 120

  RegisterPublicSubnetTags:
    Type: Custom::SubnetRegister
    Properties:
      ServiceToken: !GetAtt RegisterSubnetTags.Arn
      InfrastructureName: !Ref InfrastructureName
      Subnets: !Ref PublicSubnets

  RegisterPrivateSubnetTags:
    Type: Custom::SubnetRegister
    Properties:
      ServiceToken: !GetAtt RegisterSubnetTags.Arn
      InfrastructureName: !Ref InfrastructureName
      Subnets: !Ref PrivateSubnets

Outputs:
  PrivateHostedZoneId:
    Description: Hosted zone ID for the private DNS, which is required for private records.
    Value: !Ref IntDns
  ExternalApiLoadBalancerName:
    Description: Full name of the External API load balancer created.
    Value: !GetAtt ExtApiElb.LoadBalancerFullName
  InternalApiLoadBalancerName:
    Description: Full name of the Internal API load balancer created.
    Value: !GetAtt IntApiElb.LoadBalancerFullName
  ApiServerDnsName:
    Description: Full hostname of the API server, which is required for the Ignition config files.
    Value: !Join [".", ["api-int", !Ref ClusterName, !Ref HostedZoneName]]
  RegisterNlbIpTargetsLambda:
    Description: Lambda ARN useful to help register or deregister IP targets for these load balancers.
    Value: !GetAtt RegisterNlbIpTargets.Arn
  ExternalApiTargetGroupArn:
    Description: ARN of External API target group.
    Value: !Ref ExternalApiTargetGroup
  InternalApiTargetGroupArn:
    Description: ARN of Internal API target group.
    Value: !Ref InternalApiTargetGroup
  InternalServiceTargetGroupArn:
    Description: ARN of internal service target group.
    Value: !Ref InternalServiceTargetGroup

1.6.9. AWS でのセキュリティーグループおよびロールの作成

OpenShift Container Platform クラスターで使用するセキュリティーグループおよびロールを Amazon Web Services (AWS) で作成する必要があります。これらのコンポーネントを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用して AWS インフラストラクチャーを使用しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "VpcCidr", 3
        "ParameterValue": "10.0.0.0/16" 4
      },
      {
        "ParameterKey": "PrivateSubnets", 5
        "ParameterValue": "subnet-<random_string>" 6
      },
      {
        "ParameterKey": "VpcId", 7
        "ParameterValue": "vpc-<random_string>" 8
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    VPC の CIDR ブロック。
    4
    x.x.x.x/16-24 の形式で定義した VPC に使用した CIDR ブロックパラメーターを指定します。
    5
    VPC 用に作成したプライベートサブネット。
    6
    VPC の CloudFormation テンプレートの出力から PrivateSubnetIds 値を指定します。
    7
    クラスター用に作成した VPC。
    8
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
  2. このトピックの「セキュリティーオブジェクトの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なセキュリティーグループおよびロールについて記述しています。
  3. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-secs などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  4. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    MasterSecurityGroupId

    マスターセキュリティーグループ ID

    WorkerSecurityGroupId

    ワーカーセキュリティーグループ ID

    MasterInstanceProfile

    マスター IAM インスタンスプロファイル

    WorkerInstanceProfile

    ワーカー IAM インスタンスプロファイル

1.6.9.1. セキュリティーオブジェクトの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なセキュリティーオブジェクトをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Security Elements (Security Groups & IAM)

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 cloud resources and identify items owned or used by the cluster.
    Type: String
  VpcCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
    Default: 10.0.0.0/16
    Description: CIDR block for VPC.
    Type: String
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id
  PrivateSubnets:
    Description: The internal subnets.
    Type: List<AWS::EC2::Subnet::Id>

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - VpcCidr
      - PrivateSubnets
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      VpcCidr:
        default: "VPC CIDR"
      PrivateSubnets:
        default: "Private Subnets"

Resources:
  MasterSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Master Security Group
      SecurityGroupIngress:
      - IpProtocol: icmp
        FromPort: 0
        ToPort: 0
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        ToPort: 6443
        FromPort: 6443
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22623
        ToPort: 22623
        CidrIp: !Ref VpcCidr
      VpcId: !Ref VpcId

  WorkerSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Worker Security Group
      SecurityGroupIngress:
      - IpProtocol: icmp
        FromPort: 0
        ToPort: 0
        CidrIp: !Ref VpcCidr
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref VpcCidr
      VpcId: !Ref VpcId

  MasterIngressEtcd:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: etcd
      FromPort: 2379
      ToPort: 2380
      IpProtocol: tcp

  MasterIngressVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  MasterIngressWorkerVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  MasterIngressInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  MasterIngressWorkerInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  MasterIngressKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes kubelet, scheduler and controller manager
      FromPort: 10250
      ToPort: 10259
      IpProtocol: tcp

  MasterIngressWorkerKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes kubelet, scheduler and controller manager
      FromPort: 10250
      ToPort: 10259
      IpProtocol: tcp

  MasterIngressIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  MasterIngressWorkerIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt MasterSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  WorkerIngressVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  WorkerIngressWorkerVxlan:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Vxlan packets
      FromPort: 4789
      ToPort: 4789
      IpProtocol: udp

  WorkerIngressInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  WorkerIngressWorkerInternal:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal cluster communication
      FromPort: 9000
      ToPort: 9999
      IpProtocol: tcp

  WorkerIngressKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes secure kubelet port
      FromPort: 10250
      ToPort: 10250
      IpProtocol: tcp

  WorkerIngressWorkerKube:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Internal Kubernetes communication
      FromPort: 10250
      ToPort: 10250
      IpProtocol: tcp

  WorkerIngressIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt WorkerSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  WorkerIngressWorkerIngressServices:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      GroupId: !GetAtt WorkerSecurityGroup.GroupId
      SourceSecurityGroupId: !GetAtt MasterSecurityGroup.GroupId
      Description: Kubernetes ingress services
      FromPort: 30000
      ToPort: 32767
      IpProtocol: tcp

  MasterIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "master", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:*"
            Resource: "*"
          - Effect: "Allow"
            Action: "elasticloadbalancing:*"
            Resource: "*"
          - Effect: "Allow"
            Action: "iam:PassRole"
            Resource: "*"
          - Effect: "Allow"
            Action: "s3:GetObject"
            Resource: "*"

  MasterInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Roles:
      - Ref: "MasterIamRole"

  WorkerIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "worker", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:Describe*"
            Resource: "*"

  WorkerInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Roles:
      - Ref: "WorkerIamRole"

Outputs:
  MasterSecurityGroupId:
    Description: Master Security Group ID
    Value: !GetAtt MasterSecurityGroup.GroupId

  WorkerSecurityGroupId:
    Description: Worker Security Group ID
    Value: !GetAtt WorkerSecurityGroup.GroupId

  MasterInstanceProfile:
    Description: Master IAM Instance Profile
    Value: !Ref MasterInstanceProfile

  WorkerInstanceProfile:
    Description: Worker IAM Instance Profile
    Value: !Ref WorkerInstanceProfile

1.6.10. AWS インフラストラクチャーの RHCOS AMI

OpenShift Container Platform ノードについて、Amazon Web Services (AWS) ゾーンの有効な Red Hat Enterprise Linux CoreOS (RHCOS) AMI を使用する必要があります。

表1.11 RHCOS AMI

AWS ゾーンAWS AMI

ap-northeast-1

ami-0426ca3481a088c7b

ap-northeast-2

ami-014514ae47679721b

ap-south-1

ami-0bd772ba746948d9a

ap-southeast-1

ami-0d76ac0ebaac29e40

ap-southeast-2

ami-0391e92574fb09e08

ca-central-1

ami-04419691da69850cf

eu-central-1

ami-092b69120ecf915ed

eu-north-1

ami-0175e9c9d258cc11d

eu-west-1

ami-04370efd78434697b

eu-west-2

ami-00c74e593125e0096

eu-west-3

ami-058ad17da14ff4d0d

sa-east-1

ami-03f6b71e93e630dab

us-east-1

ami-01e7fdcb66157b224

us-east-2

ami-0bc59aaa7363b805d

us-west-1

ami-0ba912f53c1fdcdf0

us-west-2

ami-08e10b201e19fd5e7

1.6.11. AWS でのブートストラップノードの作成

OpenShift Container Platform クラスターの初期化で使用するブートストラップノードを Amazon Web Services (AWS) で作成する必要があります。このノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用してブートストラップノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。

手順

  1. bootstrap.ign Ignition 設定ファイルをクラスターに送るための場所を指定します。このファイルはインストールディレクトリーに置かれます。これを実行するための 1 つの方法として、クラスターのリージョンに S3 バケットを作成し、Ignition 設定ファイルをこれにアップロードします。ネットワークが制限されたインストールの場合、Ignition 設定ファイルを S3 バケットにアップロードする場合、事前に署名された URL を使用してこれにアクセスする必要があります。HTTP プロトコルを使用してファイルにアクセスする場合は、これを VPC 内の場所にアップロードします。

    重要

    提供される CloudFormation テンプレートでは、クラスターの Ignition 設定ファイルは S3 バケットから送られることを前提としています。このファイルを別の場所から送ることを選択する場合は、テンプレートを変更する必要があります。

    注記

    ブートストラップ Ignition 設定ファイルには、X.509 キーのようなシークレットが含まれません。以下の手順では、S3 バケットの基本的なセキュリティーを提供します。追加のセキュリティーを提供するには、OpenShift IAM ユーザーなどの特定のユーザーのみがバケットに含まれるオブジェクトにアクセスできるように S3 バケットポリシーを有効にできます。S3 を完全に回避し、ブートストラップマシンが到達できるアドレスからブートストラップ Ignition 設定ファイルを送ることができます。

    1. AWS Signature Version 4 の AWS プロファイルを設定します。

      $ aws configure set default.s3.signature_version s3v4
    2. バケットを作成します。

      $ aws s3 mb s3://<cluster-name>-infra 1
      1
      <cluster-name>-infra はバケット名です。
    3. bootstrap.ign Ignition 設定ファイルをバケットにアップロードします。

      $ aws s3 cp bootstrap.ign s3://<cluster-name>-infra/bootstrap.ign
    4. ファイルがアップロードされていることを確認します。

      $ aws s3 ls s3://<cluster-name>-infra/
      
      2019-04-03 16:15:16     314878 bootstrap.ign
    5. HTTPS プロトコルを使用してアップロードしたイメージにアクセスするための事前に署名された URL を生成します。

      $ aws s3 presign s3://<cluster-name>-infra/bootstrap.ign --region <s3_bucket_region> --expires-in <time_in_seconds> 1
      1
      <time_in_seconds> については、事前に署名された URL が有効である期間を秒単位で指定します。

      コマンド出力には、署名された URL が含まれます。

      https://<cluster-name>-infra/bootstrap.ign?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1556132848
  2. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "RhcosAmi", 3
        "ParameterValue": "ami-<random_string>" 4
      },
      {
        "ParameterKey": "AllowedBootstrapSshCidr", 5
        "ParameterValue": "0.0.0.0/0" 6
      },
      {
        "ParameterKey": "PublicSubnet", 7
        "ParameterValue": "subnet-<random_string>" 8
      },
      {
        "ParameterKey": "MasterSecurityGroupId", 9
        "ParameterValue": "sg-<random_string>" 10
      },
      {
        "ParameterKey": "VpcId", 11
        "ParameterValue": "vpc-<random_string>" 12
      },
      {
        "ParameterKey": "BootstrapIgnitionLocation", 13
        "ParameterValue": "s3://<bucket_name>/bootstrap.ign" 14
      },
      {
        "ParameterKey": "AutoRegisterELB", 15
        "ParameterValue": "yes" 16
      },
      {
        "ParameterKey": "RegisterNlbIpTargetsLambdaArn", 17
        "ParameterValue": "arn:aws:lambda:<region>:<account_number>:function:<dns_stack_name>-RegisterNlbIpTargets-<random_string>" 18
      },
      {
        "ParameterKey": "ExternalApiTargetGroupArn", 19
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Exter-<random_string>" 20
      },
      {
        "ParameterKey": "InternalApiTargetGroupArn", 21
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 22
      },
      {
        "ParameterKey": "InternalServiceTargetGroupArn", 23
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 24
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    ブートストラップノードに使用する最新の Red Hat Enterprise Linux CoreOS (RHCOS) AMI。
    4
    有効な AWS::EC2::Image::Id 値を指定します。
    5
    ブートストラップノードへの SSH アクセスを許可する CIDR ブロック。
    6
    x.x.x.x/16-24 形式で CIDR ブロックを指定します。
    7
    ブートストラップを起動するために VPC に関連付けられるパブリックサブネット。
    8
    VPC の CloudFormation テンプレートの出力から PublicSubnetIds 値を指定します。
    9
    マスターセキュリティーグループ ID (一時ルールの登録用)
    10
    セキュリティーグループおよびロールの CloudFormation テンプレートから MasterSecurityGroupId 値を指定します。
    11
    作成されたリソースが属する VPC。
    12
    VPC の CloudFormation テンプレートの出力から VpcId 値を指定します。
    13
    ブートストラップの Ignition 設定ファイルをフェッチする場所。
    14
    ブートストラップファイルの場所を指定します。生成した事前に署名されたイメージ URL、または s3://<bucket_name>/bootstrap.ign 形式の S3 バケットおよびファイル名のいずれかを入力します。
    15
    ネットワークロードバランサー (NLB) を登録するかどうか。
    16
    yes または no を指定します。yes を指定する場合、Lambda Amazon Resource Name (ARN) の値を指定する必要があります。
    17
    NLB IP ターゲット登録 lambda グループの ARN。
    18
    DNS および負荷分散の CloudFormation テンプレートの出力から RegisterNlbIpTargetsLambda 値を指定します。
    19
    外部 API ロードバランサーのターゲットグループの ARN。
    20
    DNS および負荷分散の CloudFormation テンプレートの出力から ExternalApiTargetGroupArn 値を指定します。
    21
    内部 API ロードバランサーのターゲットグループの ARN。
    22
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalApiTargetGroupArn 値を指定します。
    23
    内部サービスバランサーのターゲットグループの ARN。
    24
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalServiceTargetGroupArn 値を指定します。
  3. このトピックの「ブートストラップマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なブートストラップマシンについて記述しています。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
         --capabilities CAPABILITY_NAMED_IAM
    1
    <name>cluster-bootstrap などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

    StackStatusCREATE_COMPLETE を表示した後に、出力には以下のパラメーターの値が表示されます。これらのパラメーターの値をクラスターを作成するために実行する他の CloudFormation テンプレートに指定する必要があります。

    BootstrapInstanceId

    ブートストラップインスタンス ID。

    BootstrapPublicIp

    ブートストラップノードのパブリック IP アドレス。

    BootstrapPrivateIp

    ブートストラップノードのプライベート IP アドレス。

1.6.11.1. ブートストラップマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なブートストラップマシンをデプロイできます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Bootstrap (EC2 Instance, Security Groups and IAM)

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 cloud resources and identify items owned or used by the cluster.
    Type: String
  RhcosAmi:
    Description: Current Red Hat Enterprise Linux CoreOS AMI to use for bootstrap.
    Type: AWS::EC2::Image::Id
  AllowedBootstrapSshCidr:
    AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|1[0-9]|2[0-9]|3[0-2]))$
    ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/0-32.
    Default: 0.0.0.0/0
    Description: CIDR block to allow SSH access to the bootstrap node.
    Type: String
  PublicSubnet:
    Description: The public subnet to launch the bootstrap node into.
    Type: AWS::EC2::Subnet::Id
  MasterSecurityGroupId:
    Description: The master security group ID for registering temporary rules.
    Type: AWS::EC2::SecurityGroup::Id
  VpcId:
    Description: The VPC-scoped resources will belong to this VPC.
    Type: AWS::EC2::VPC::Id
  BootstrapIgnitionLocation:
    Default: s3://my-s3-bucket/bootstrap.ign
    Description: Ignition config file location.
    Type: String
  AutoRegisterELB:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke NLB registration, which requires a Lambda ARN parameter?
    Type: String
  RegisterNlbIpTargetsLambdaArn:
    Description: ARN for NLB IP target registration lambda.
    Type: String
  ExternalApiTargetGroupArn:
    Description: ARN for external API load balancer target group.
    Type: String
  InternalApiTargetGroupArn:
    Description: ARN for internal API load balancer target group.
    Type: String
  InternalServiceTargetGroupArn:
    Description: ARN for internal service load balancer target group.
    Type: String

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Host Information"
      Parameters:
      - RhcosAmi
      - BootstrapIgnitionLocation
      - MasterSecurityGroupId
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - AllowedBootstrapSshCidr
      - PublicSubnet
    - Label:
        default: "Load Balancer Automation"
      Parameters:
      - AutoRegisterELB
      - RegisterNlbIpTargetsLambdaArn
      - ExternalApiTargetGroupArn
      - InternalApiTargetGroupArn
      - InternalServiceTargetGroupArn
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      AllowedBootstrapSshCidr:
        default: "Allowed SSH Source"
      PublicSubnet:
        default: "Public Subnet"
      RhcosAmi:
        default: "Red Hat Enterprise Linux CoreOS AMI ID"
      BootstrapIgnitionLocation:
        default: "Bootstrap Ignition Source"
      MasterSecurityGroupId:
        default: "Master Security Group ID"
      AutoRegisterELB:
        default: "Use Provided ELB Automation"

Conditions:
  DoRegistration: !Equals ["yes", !Ref AutoRegisterELB]

Resources:
  BootstrapIamRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
        - Effect: "Allow"
          Principal:
            Service:
            - "ec2.amazonaws.com"
          Action:
          - "sts:AssumeRole"
      Path: "/"
      Policies:
      - PolicyName: !Join ["-", [!Ref InfrastructureName, "bootstrap", "policy"]]
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
          - Effect: "Allow"
            Action: "ec2:Describe*"
            Resource: "*"
          - Effect: "Allow"
            Action: "ec2:AttachVolume"
            Resource: "*"
          - Effect: "Allow"
            Action: "ec2:DetachVolume"
            Resource: "*"
          - Effect: "Allow"
            Action: "s3:GetObject"
            Resource: "*"

  BootstrapInstanceProfile:
    Type: "AWS::IAM::InstanceProfile"
    Properties:
      Path: "/"
      Roles:
      - Ref: "BootstrapIamRole"

  BootstrapSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Cluster Bootstrap Security Group
      SecurityGroupIngress:
      - IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: !Ref AllowedBootstrapSshCidr
      - IpProtocol: tcp
        ToPort: 19531
        FromPort: 19531
        CidrIp: 0.0.0.0/0
      VpcId: !Ref VpcId

  BootstrapInstance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      IamInstanceProfile: !Ref BootstrapInstanceProfile
      InstanceType: "i3.large"
      NetworkInterfaces:
      - AssociatePublicIpAddress: "true"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "BootstrapSecurityGroup"
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "PublicSubnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"replace":{"source":"${S3Loc}","verification":{}}},"timeouts":{},"version":"2.1.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          S3Loc: !Ref BootstrapIgnitionLocation
        }

  RegisterBootstrapApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

  RegisterBootstrapInternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

  RegisterBootstrapInternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt BootstrapInstance.PrivateIp

Outputs:
  BootstrapInstanceId:
    Description: Bootstrap Instance ID.
    Value: !Ref BootstrapInstance

  BootstrapPublicIp:
    Description: The bootstrap node public IP address.
    Value: !GetAtt BootstrapInstance.PublicIp

  BootstrapPrivateIp:
    Description: The bootstrap node private IP address.
    Value: !GetAtt BootstrapInstance.PrivateIp

1.6.12. AWS でのコントロールプレーンの作成

クラスターで使用するコントロールプレーンマシンを Amazon Web Services (AWS) で作成する必要があります。これらのノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

注記

提供される CloudFormation テンプレートを使用してコントロールプレーンノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。

手順

  1. テンプレートが必要とするパラメーター値が含まれる JSON ファイルを作成します。

    [
      {
        "ParameterKey": "InfrastructureName", 1
        "ParameterValue": "mycluster-<random_string>" 2
      },
      {
        "ParameterKey": "RhcosAmi", 3
        "ParameterValue": "ami-<random_string>" 4
      },
      {
        "ParameterKey": "AutoRegisterDNS", 5
        "ParameterValue": "yes" 6
      },
      {
        "ParameterKey": "PrivateHostedZoneId", 7
        "ParameterValue": "<random_string>" 8
      },
      {
        "ParameterKey": "PrivateHostedZoneName", 9
        "ParameterValue": "mycluster.example.com" 10
      },
      {
        "ParameterKey": "Master0Subnet", 11
        "ParameterValue": "subnet-<random_string>" 12
      },
      {
        "ParameterKey": "Master1Subnet", 13
        "ParameterValue": "subnet-<random_string>" 14
      },
      {
        "ParameterKey": "Master2Subnet", 15
        "ParameterValue": "subnet-<random_string>" 16
      },
      {
        "ParameterKey": "MasterSecurityGroupId", 17
        "ParameterValue": "sg-<random_string>" 18
      },
      {
        "ParameterKey": "IgnitionLocation", 19
        "ParameterValue": "https://api-int.<cluster_name>.<domain_name>:22623/config/master" 20
      },
      {
        "ParameterKey": "CertificateAuthorities", 21
        "ParameterValue": "data:text/plain;charset=utf-8;base64,ABC...xYz==" 22
      },
      {
        "ParameterKey": "MasterInstanceProfileName", 23
        "ParameterValue": "<roles_stack>-MasterInstanceProfile-<random_string>" 24
      },
      {
        "ParameterKey": "MasterInstanceType", 25
        "ParameterValue": "m4.xlarge" 26
      },
      {
        "ParameterKey": "AutoRegisterELB", 27
        "ParameterValue": "yes" 28
      },
      {
        "ParameterKey": "RegisterNlbIpTargetsLambdaArn", 29
        "ParameterValue": "arn:aws:lambda:<region>:<account_number>:function:<dns_stack_name>-RegisterNlbIpTargets-<random_string>" 30
      },
      {
        "ParameterKey": "ExternalApiTargetGroupArn", 31
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Exter-<random_string>" 32
      },
      {
        "ParameterKey": "InternalApiTargetGroupArn", 33
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 34
      },
      {
        "ParameterKey": "InternalServiceTargetGroupArn", 35
        "ParameterValue": "arn:aws:elasticloadbalancing:<region>:<account_number>:targetgroup/<dns_stack_name>-Inter-<random_string>" 36
      }
    ]
    1
    クラスターの Ingition 設定ファイルでエンコードされるクラスターインフラストラクチャーの名前。
    2
    形式が <cluster-name>-<random-string> の Ignition 設定ファイルから抽出したインフラストラクチャー名を指定します。
    3
    コントロールプレーンマシンに使用する最新の Red Hat Enterprise Linux CoreOS (RHCOS) AMI。
    4
    AWS::EC2::Image::Id 値を指定します。
    5
    DNS etcd 登録を実行するかどうか。
    6
    yes または no を指定します。yes を指定する場合、ホストゾーンの情報を指定する必要があります。
    7
    etcd ターゲットの登録に使用する Route53 プライベートゾーン ID。
    8
    DNS および負荷分散の CloudFormation テンプレートの出力から PrivateHostedZoneId 値を指定します。
    9
    ターゲットの登録に使用する Route53 ゾーン。
    10
    <cluster_name>.<domain_name> を指定します。ここで、<domain_name> はクラスターの install-config.yaml ファイルの生成時に使用した Route53 ベースドメインです。AWS コンソールに表示される末尾のピリド (.) は含めないでください。
    11 13 15
    コントロールプレーンマシンの起動に使用するサブネット (プライベートが望ましい)。
    12 14 16
    DNS および負荷分散の CloudFormation テンプレートの出力から PrivateSubnets 値のサブネットを指定します。
    17
    マスターノードに関連付けるマスターセキュリティーグループ ID。
    18
    セキュリティーグループおよびロールの CloudFormation テンプレートから MasterSecurityGroupId 値を指定します。
    19
    コントロールプレーンの Ignition 設定ファイルをフェッチする場所。
    20
    生成される Ignition 設定ファイルの場所を指定します (https://api-int.<cluster_name>.<domain_name>:22623/config/master)。
    21
    使用する base64 でエンコードされた認証局の文字列。
    22
    インストールディレクトリーにある master.ign ファイルから値を指定します。この値は、data:text/plain;charset=utf-8;base64,ABC…​xYz== 形式の長い文字列です。
    23
    マスターロールに関連付ける IAM プロファイル。
    24
    セキュリティーグループおよびロールの CloudFormation テンプレートの出力から MasterInstanceProfile パラメーターの値を指定します。
    25
    コントロールプレーンマシンに使用する AWS インスタンスのタイプ。
    26
    許可される値:
    • m4.xlarge
    • m4.2xlarge
    • m4.4xlarge
    • m4.8xlarge
    • m4.10xlarge
    • m4.16xlarge
    • c4.2xlarge
    • c4.4xlarge
    • c4.8xlarge
    • r4.xlarge
    • r4.2xlarge
    • r4.4xlarge
    • r4.8xlarge
    • r4.16xlarge

      重要

      m4 インスタンスタイプが eu-west-3 などのリージョンで利用可能ではない場合、m5.xlarge などのように m5 タイプを代わりに使用します。

    27
    ネットワークロードバランサー (NLB) を登録するかどうか。
    28
    yes または no を指定します。yes を指定する場合、Lambda Amazon Resource Name (ARN) の値を指定する必要があります。
    29
    NLB IP ターゲット登録 lambda グループの ARN。
    30
    DNS および負荷分散の CloudFormation テンプレートの出力から RegisterNlbIpTargetsLambda 値を指定します。
    31
    外部 API ロードバランサーのターゲットグループの ARN。
    32
    DNS および負荷分散の CloudFormation テンプレートの出力から ExternalApiTargetGroupArn 値を指定します。
    33
    内部 API ロードバランサーのターゲットグループの ARN。
    34
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalApiTargetGroupArn 値を指定します。
    35
    内部サービスバランサーのターゲットグループの ARN。
    36
    DNS および負荷分散の CloudFormation テンプレートの出力から InternalServiceTargetGroupArn 値を指定します。
  2. このトピックの「コントロールプレーンマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なコントロールプレーンのマシンについて記述しています。
  3. m5 インスタンスタイプを MasterInstanceType の値として指定している場合、そのインスタンスタイプを CloudFormation テンプレートの MasterInstanceType.AllowedValues パラメーターに追加します。
  4. テンプレートを起動します。

    重要

    単一行にコマンドを入力してください。

    $ aws cloudformation create-stack --stack-name <name> 1
         --template-body file://<template>.yaml 2
         --parameters file://<parameters>.json 3
    1
    <name>cluster-control-plane などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
    2
    <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
    3
    <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
  5. テンプレートのコンポーネントが存在することを確認します。

    $ aws cloudformation describe-stacks --stack-name <name>

1.6.12.1. コントロールプレーンマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なコントロールプレーンマシンをデプロイすることができます。

AWSTemplateFormatVersion: 2010-09-09
Description: Template for OpenShift Cluster Node Launch (EC2 master instances)

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
  AutoRegisterDNS:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke DNS etcd registration, which requires Hosted Zone information?
    Type: String
  PrivateHostedZoneId:
    Description: The Route53 private zone ID to register the etcd targets with, such as Z21IXYZABCZ2A4.
    Type: String
  PrivateHostedZoneName:
    Description: The Route53 zone to register the targets with, such as cluster.example.com. Omit the trailing period.
    Type: String
  Master0Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  Master1Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  Master2Subnet:
    Description: The subnets, recommend private, to launch the master nodes into.
    Type: AWS::EC2::Subnet::Id
  MasterSecurityGroupId:
    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/master
    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
  MasterInstanceProfileName:
    Description: IAM profile to associate with master nodes.
    Type: String
  MasterInstanceType:
    Default: m4.xlarge
    Type: String
    AllowedValues:
    - "m4.xlarge"
    - "m4.2xlarge"
    - "m4.4xlarge"
    - "m4.8xlarge"
    - "m4.10xlarge"
    - "m4.16xlarge"
    - "c4.2xlarge"
    - "c4.4xlarge"
    - "c4.8xlarge"
    - "r4.xlarge"
    - "r4.2xlarge"
    - "r4.4xlarge"
    - "r4.8xlarge"
    - "r4.16xlarge"
  AutoRegisterELB:
    Default: "yes"
    AllowedValues:
    - "yes"
    - "no"
    Description: Do you want to invoke NLB registration, which requires a Lambda ARN parameter?
    Type: String
  RegisterNlbIpTargetsLambdaArn:
    Description: ARN for NLB IP target registration lambda. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  ExternalApiTargetGroupArn:
    Description: ARN for external API load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  InternalApiTargetGroupArn:
    Description: ARN for internal API load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String
  InternalServiceTargetGroupArn:
    Description: ARN for internal service load balancer target group. Supply the value from the cluster infrastructure or select "no" for AutoRegisterELB.
    Type: String

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
    - Label:
        default: "Cluster Information"
      Parameters:
      - InfrastructureName
    - Label:
        default: "Host Information"
      Parameters:
      - MasterInstanceType
      - RhcosAmi
      - IgnitionLocation
      - CertificateAuthorities
      - MasterSecurityGroupId
      - MasterInstanceProfileName
    - Label:
        default: "Network Configuration"
      Parameters:
      - VpcId
      - AllowedBootstrapSshCidr
      - Master0Subnet
      - Master1Subnet
      - Master2Subnet
    - Label:
        default: "DNS"
      Parameters:
      - AutoRegisterDNS
      - PrivateHostedZoneName
      - PrivateHostedZoneId
    - Label:
        default: "Load Balancer Automation"
      Parameters:
      - AutoRegisterELB
      - RegisterNlbIpTargetsLambdaArn
      - ExternalApiTargetGroupArn
      - InternalApiTargetGroupArn
      - InternalServiceTargetGroupArn
    ParameterLabels:
      InfrastructureName:
        default: "Infrastructure Name"
      VpcId:
        default: "VPC ID"
      Master0Subnet:
        default: "Master-0 Subnet"
      Master1Subnet:
        default: "Master-1 Subnet"
      Master2Subnet:
        default: "Master-2 Subnet"
      MasterInstanceType:
        default: "Master Instance Type"
      MasterInstanceProfileName:
        default: "Master Instance Profile Name"
      RhcosAmi:
        default: "Red Hat Enterprise Linux CoreOS AMI ID"
      BootstrapIgnitionLocation:
        default: "Master Ignition Source"
      CertificateAuthorities:
        default: "Ignition CA String"
      MasterSecurityGroupId:
        default: "Master Security Group ID"
      AutoRegisterDNS:
        default: "Use Provided DNS Automation"
      AutoRegisterELB:
        default: "Use Provided ELB Automation"
      PrivateHostedZoneName:
        default: "Private Hosted Zone Name"
      PrivateHostedZoneId:
        default: "Private Hosted Zone ID"

Conditions:
  DoRegistration: !Equals ["yes", !Ref AutoRegisterELB]
  DoDns: !Equals ["yes", !Ref AutoRegisterDNS]

Resources:
  Master0:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master0Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster0:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  RegisterMaster0InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  RegisterMaster0InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master0.PrivateIp

  Master1:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master1Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster1:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  RegisterMaster1InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  RegisterMaster1InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master1.PrivateIp

  Master2:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref RhcosAmi
      BlockDeviceMappings:
      - DeviceName: /dev/xvda
        Ebs:
          VolumeSize: "120"
          VolumeType: "gp2"
      IamInstanceProfile: !Ref MasterInstanceProfileName
      InstanceType: !Ref MasterInstanceType
      NetworkInterfaces:
      - AssociatePublicIpAddress: "false"
        DeviceIndex: "0"
        GroupSet:
        - !Ref "MasterSecurityGroupId"
        SubnetId: !Ref "Master2Subnet"
      UserData:
        Fn::Base64: !Sub
        - '{"ignition":{"config":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          SOURCE: !Ref IgnitionLocation,
          CA_BUNDLE: !Ref CertificateAuthorities,
        }
      Tags:
      - Key: !Join ["", ["kubernetes.io/cluster/", !Ref InfrastructureName]]
        Value: "shared"

  RegisterMaster2:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref ExternalApiTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  RegisterMaster2InternalApiTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalApiTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  RegisterMaster2InternalServiceTarget:
    Condition: DoRegistration
    Type: Custom::NLBRegister
    Properties:
      ServiceToken: !Ref RegisterNlbIpTargetsLambdaArn
      TargetArn: !Ref InternalServiceTargetGroupArn
      TargetIp: !GetAtt Master2.PrivateIp

  EtcdSrvRecords:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["_etcd-server-ssl._tcp", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-0", !Ref PrivateHostedZoneName]]],
      ]
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-1", !Ref PrivateHostedZoneName]]],
      ]
      - !Join [
        " ",
        ["0 10 2380", !Join [".", ["etcd-2", !Ref PrivateHostedZoneName]]],
      ]
      TTL: 60
      Type: SRV

  Etcd0Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-0", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master0.PrivateIp
      TTL: 60
      Type: A

  Etcd1Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-1", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master1.PrivateIp
      TTL: 60
      Type: A

  Etcd2Record:
    Condition: DoDns
    Type: AWS::Route53::RecordSet
    Properties:
      HostedZoneId: !Ref PrivateHostedZoneId
      Name: !Join [".", ["etcd-2", !Ref PrivateHostedZoneName]]
      ResourceRecords:
      - !GetAtt Master2.PrivateIp
      TTL: 60
      Type: A

Outputs:
  PrivateIPs:
    Description: The control-plane node private IP addresses.
    Value:
      !Join [
        ",",
        [!GetAtt Master0.PrivateIp, !GetAtt Master1.PrivateIp, !GetAtt Master2.PrivateIp]
      ]

1.6.13. ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS でのブートストラップノードの初期化

Amazon Web Services (AWS) ですべての必要なインフラストラクチャーを作成した後に、クラスターをインストールできます。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。
  • コントロールプレーンマシンを作成します。
  • ワーカーマシンを手動で管理する予定の場合には、ワーカーマシンを作成します。

手順

  1. インストールプログラムが含まれるディレクトリーに切り替え、以下のコマンドを実行します。

    $ ./openshift-install wait-for bootstrap-complete --dir=<installation_directory> \ 1
        --log-level=info 2
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    2
    異なるインストールの詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。

    コマンドが FATAL 警告を出さずに終了する場合、実稼働用のコントロールプレーンは初期化されています。

1.6.13.1. AWS でのワーカーノードの作成

クラスターで使用するワーカーノードを Amazon Web Services (AWS) で作成できます。これらのノードを作成するための最も簡単な方法として、提供される CloudFormation テンプレートを変更することができます。

重要

CloudFormation テンプレートは、1 つのワーカーマシンを表すスタックを作成します。それぞれのワーカーマシンにスタックを作成する必要があります。

注記

提供される CloudFormation テンプレートを使用してワーカーノードを作成しない場合、提供される情報を確認し、インフラストラクチャーを手動で作成する必要があります。クラスターが適切に初期化されない場合、インストールログを用意して Red Hat サポートに問い合わせする必要がある可能性があります。

前提条件

  • AWS アカウントを設定します。
  • クラスターの Ignition 設定ファイルを生成します。
  • AWS で VPC および関連するサブネットを作成し、設定します。
  • AWS で DNS、ロードバランサー、およびリスナーを作成し、設定します。
  • コントロールプレーンおよびコンピュートロールを作成します。
  • ブートストラップマシンを作成します。
  • コントロールプレーンマシンを作成します。

手順

  1. 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
    • c4.large
    • c4.xlarge
    • c4.2xlarge
    • c4.4xlarge
    • c4.8xlarge
    • r4.large
    • r4.xlarge
    • r4.2xlarge
    • r4.4xlarge
    • r4.8xlarge
    • r4.16xlarge

      重要

      m4 インスタンスが eu-west-3 などのリージョンで利用可能ではない場合、m5 タイプを代わりに使用します。

  2. このトピックの「ワーカーマシンの CloudFormation テンプレート」セクションからテンプレートをコピーし、これをコンピューター上に YAML ファイルとして保存します。このテンプレートは、クラスターに必要なネットワークオブジェクトおよびロードバランサーについて記述しています。
  3. m5 インスタンスタイプを WorkerInstanceType の値として指定している場合、そのインスタンスタイプを CloudFormation テンプレートの WorkerInstanceType.AllowedValues パラメーターに追加します。
  4. ワーカースタックを作成します。

    1. テンプレートを起動します。

      重要

      単一行にコマンドを入力してください。

      $ aws cloudformation create-stack --stack-name <name> 1
           --template-body file://<template>.yaml \ 2
           --parameters file://<parameters>.json 3
      1
      <name>cluster-workers などの CloudFormation スタックの名前です。クラスターを削除する場合に、このスタックの名前が必要になります。
      2
      <template> は、保存した CloudFormation テンプレート YAML ファイルへの相対パスまたは名前です。
      3
      <parameters> は、CloudFormation パラメーター JSON ファイルへの相対パスまたは名前です。
    2. テンプレートのコンポーネントが存在することを確認します。

      $ aws cloudformation describe-stacks --stack-name <name>
  5. クラスターに作成するワーカーマシンが十分な数に達するまでワーカースタックの作成を継続します。

    重要

    2 つ以上のワーカーマシンを作成する必要があるため、この CloudFormation テンプレートを使用する 2 つ以上のスタックを作成する必要があります。

1.6.13.1.1. ワーカーマシンの CloudFormation テンプレート

以下の CloudFormation テンプレートを使用し、OpenShift Container Platform クラスターに必要なワーカーマシンをデプロイすることができます。

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: m4.large
    Type: String
    AllowedValues:
    - "m4.large"
    - "m4.xlarge"
    - "m4.2xlarge"
    - "m4.4xlarge"
    - "m4.8xlarge"
    - "m4.10xlarge"
    - "m4.16xlarge"
    - "c4.large"
    - "c4.xlarge"
    - "c4.2xlarge"
    - "c4.4xlarge"
    - "c4.8xlarge"
    - "r4.large"
    - "r4.xlarge"
    - "r4.2xlarge"
    - "r4.4xlarge"
    - "r4.8xlarge"
    - "r4.16xlarge"

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":{"append":[{"source":"${SOURCE}","verification":{}}]},"security":{"tls":{"certificateAuthorities":[{"source":"${CA_BUNDLE}","verification":{}}]}},"timeouts":{},"version":"2.2.0"},"networkd":{},"passwd":{},"storage":{},"systemd":{}}'
        - {
          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

1.6.14. クラスターへのログイン

クラスター kubeconfig ファイルをエクスポートし、デフォルトシステムユーザーとしてクラスターにログインできます。kubeconfig ファイルには、クライアントを正しいクラスターおよび API サーバーに接続するために CLI で使用されるクラスターについての情報が含まれます。このファイルはクラスターに固有のファイルであり、OpenShift Container Platform のインストール時に作成されます。

前提条件

  • OpenShift Container Platform クラスターのデプロイ。
  • oc CLI のインストール。

手順

  1. kubeadmin 認証情報をエクスポートします。

    $ export KUBECONFIG=<installation_directory>/auth/kubeconfig 1
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
  2. エクスポートされた設定を使用して、oc コマンドを正常に実行できることを確認します。

    $ oc whoami
    system:admin

1.6.15. マシンの CSR の承認

マシンをクラスターに追加する際に、追加したそれぞれのマシンについて 2 つの保留状態の証明書署名要求 (CSR) が生成されます。これらの CSR が承認されていることを確認するか、または必要な場合はそれらを承認してください。

前提条件

  • マシンをクラスターに追加していること。

手順

  1. クラスターがマシンを認識していることを確認します。

    $ oc get nodes
    
    NAME      STATUS    ROLES   AGE  VERSION
    master-0  Ready     master  63m  v1.14.6+c4799753c
    master-1  Ready     master  63m  v1.14.6+c4799753c
    master-2  Ready     master  64m  v1.14.6+c4799753c
    worker-0  NotReady  worker  76s  v1.14.6+c4799753c
    worker-1  NotReady  worker  70s  v1.14.6+c4799753c

    出力には作成したすべてのマシンが一覧表示されます。

  2. 保留中の証明書署名要求 (CSR) を確認し、クラスターに追加したそれぞれのマシンのクライアントおよびサーバー要求に Pending または Approved ステータスが表示されていることを確認します。

    $ oc get csr
    
    NAME        AGE     REQUESTOR                                                                   CONDITION
    csr-8b2br   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending 1
    csr-8vnps   15m     system:serviceaccount:openshift-machine-config-operator:node-bootstrapper   Pending
    csr-bfd72   5m26s   system:node:ip-10-0-50-126.us-east-2.compute.internal                       Pending 2
    csr-c57lv   5m26s   system:node:ip-10-0-95-157.us-east-2.compute.internal                       Pending
    ...
    1
    クライアント要求の CSR。
    2
    サーバー要求の CSR。

    この例では、2 つのマシンがクラスターに参加しています。この一覧にはさらに多くの承認された CSR が表示される可能性があります。

  3. 追加したマシンの保留中の CSR すべてが Pending ステータスになった後に CSR が承認されない場合には、クラスターマシンの CSR を承認します。

    注記

    CSR のローテーションは自動的に実行されるため、クラスターにマシンを追加後 1 時間以内に CSR を承認してください。1 時間以内に承認しない場合には、証明書のローテーションが行われ、各ノードに 3 つ以上の証明書が存在するようになります。これらの証明書すべてを承認する必要があります。最初の CSR の承認後、後続のノードクライアント CSR はクラスターの kube-controller-manger によって自動的に承認されます。kubelet 提供証明書の要求を自動的に承認する方法を実装する必要があります。

    • それらを個別に承認するには、それぞれの有効な CSR について以下のコマンドを実行します。

      $ oc adm certificate approve <csr_name> 1
      1
      <csr_name> は、現行の CSR の一覧からの CSR の名前です。
    • すべての保留中の CSR を承認するには、以下のコマンドを実行します。

      $ oc get csr -o go-template='{{range .items}}{{if not .status}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}' | xargs oc adm certificate approve

1.6.16. Operator の初期設定

コントロールプレーンの初期化後に、一部の Operator を利用可能にするためにそれらをすぐに設定する必要があります。

前提条件

  • コントロールプレーンが初期化されていること。

手順

  1. クラスターコンポーネントがオンラインになることを確認します。

    $ watch -n5 oc get clusteroperators
    
    NAME                                 VERSION   AVAILABLE   PROGRESSING   DEGRADED   SINCE
    authentication                       4.2.0     True        False         False      69s
    cloud-credential                     4.2.0     True        False         False      12m
    cluster-autoscaler                   4.2.0     True        False         False      11m
    console                              4.2.0     True        False         False      46s
    dns                                  4.2.0     True        False         False      11m
    image-registry                       4.2.0     False       True          False      5m26s
    ingress                              4.2.0     True        False         False      5m36s
    kube-apiserver                       4.2.0     True        False         False      8m53s
    kube-controller-manager              4.2.0     True        False         False      7m24s
    kube-scheduler                       4.2.0     True        False         False      12m
    machine-api                          4.2.0     True        False         False      12m
    machine-config                       4.2.0     True        False         False      7m36s
    marketplace                          4.2.0     True        False         False      7m54m
    monitoring                           4.2.0     True        False         False      7h54s
    network                              4.2.0     True        False         False      5m9s
    node-tuning                          4.2.0     True        False         False      11m
    openshift-apiserver                  4.2.0     True        False         False      11m
    openshift-controller-manager         4.2.0     True        False         False      5m943s
    openshift-samples                    4.2.0     True        False         False      3m55s
    operator-lifecycle-manager           4.2.0     True        False         False      11m
    operator-lifecycle-manager-catalog   4.2.0     True        False         False      11m
    service-ca                           4.2.0     True        False         False      11m
    service-catalog-apiserver            4.2.0     True        False         False      5m26s
    service-catalog-controller-manager   4.2.0     True        False         False      5m25s
    storage                              4.2.0     True        False         False      5m30s
  2. 利用不可の Operator を設定します。

1.6.16.1. イメージレジストリーストレージの設定

image-registry Operator が利用できない場合、そのストレージを設定する必要があります。実稼働クラスターに必要な PersistentVolume の設定方法と、実稼働用ではないクラスターにのみ使用できる空のディレクトリーをストレージの場所として設定する方法が表示されます。

1.6.16.1.1. ユーザーによってプロビジョニングされるインフラストラクチャーで AWS のレジストリーストレージを設定する

インストール時に、S3 バケットを作成するにはクラウド認証情報を使用でき、レジストリー Operator がストレージを自動的に設定します。

レジストリー Operator が S3 バケットを作成できず、ストレージを自動的に設定する場合、以下の手順により S3 バケットを作成し、ストレージを設定することができます。

前提条件

  • ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS 上のクラスター
  • AWS ストレージの S3 の場合、シークレットには以下のキーが含まれることが予想されます。

    • REGISTRY_STORAGE_S3_ACCESSKEY
    • REGISTRY_STORAGE_S3_SECRETKEY

手順

レジストリー Operator が S3 バケットを作成できず、ストレージを自動的に設定する場合は、以下の手順を使用してください。

  1. バケットライフサイクルポリシーを設定し、1 日以上経過している未完了のマルチパートアップロードを中止します。
  2. configs.imageregistry.operator.openshift.io/cluster にストレージ設定を入力します。

    $ oc edit configs.imageregistry.operator.openshift.io/cluster
    
    storage:
      s3:
        bucket: <bucket-name>
        region: <region-name>
警告

AWS でレジストリーイメージのセキュリティーを保護するには、S3 バケットに対してパブリックアクセスのブロックを実行します。

1.6.16.1.2. 実稼働以外のクラスターでのイメージレジストリーのストレージの設定

イメージレジストリー Operator のストレージを設定する必要があります。実稼働用以外のクラスターの場合、イメージレジストリーは空のディレクトリーに設定することができます。これを実行する場合、レジストリーを再起動するとすべてのイメージが失われます。

手順

  • イメージレジストリーストレージを空のディレクトリーに設定するには、以下を実行します。

    $ oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
    警告

    実稼働用以外のクラスターにのみこのオプションを設定します。

    イメージレジストリー Operator がそのコンポーネントを初期化する前にこのコマンドを実行する場合、oc patch コマンドは以下のエラーを出して失敗します。

    Error from server (NotFound): configs.imageregistry.operator.openshift.io "cluster" not found

    数分待機した後に、このコマンドを再び実行します。

1.6.17. ブートストラップリソースの削除

クラスターの初期 Operator 設定の完了後に、Amazon Web Services (AWS) からブートストラップリソースを削除します。

前提条件

  • クラスターの初期 Operator 設定を完了している。

手順

  1. ブートストラップリソースを削除します。CloudFormation テンプレートを使用した場合は、 そのスタックを削除します。

    $ aws cloudformation delete-stack --stack-name <name> 1
    1
    <name> は、ブートストラップスタックの名前です。

1.6.18. Ingress DNS レコードの作成

DNS ゾーン設定を削除した場合には、Ingress ロードバランサーを参照する DNS レコードを手動で作成します。ワイルドカードレコードまたは特定のレコードのいずれかを作成できます。以下の手順では A レコードを使用しますが、CNAME やエイリアスなどの必要な他のレコードタイプを使用できます。

前提条件

  • 独自にプロビジョニングしたインフラストラクチャーを使用する OpenShift Container Platform クラスターを Amazon Web Services (AWS) にデプロイしている。
  • oc として知られる OpenShift コマンドラインインターフェース (CLI) のインストール。
  • jq パッケージのインストール。
  • AWS CLI をダウンロードし、これをコンピューターにインストールします。「Install the AWS CLI Using the Bundled Installer (Linux, macOS, or Unix)」を参照してください。

手順

  1. 作成するルートを決定します。

    • ワイルドカードレコードを作成するには、*.apps.<cluster_name>.<domain_name> を使用します。ここで、<cluster_name> はクラスター名で、<domain_name> は OpenShift Container Platform クラスターの Route53 ベースドメインです。
    • 特定のレコードを作成するには、以下のコマンドの出力にあるように、クラスターが使用する各ルートにレコードを作成する必要があります。

      $ oc get --all-namespaces -o jsonpath='{range .items[*]}{range .status.ingress[*]}{.host}{"\n"}{end}{end}' routes
      oauth-openshift.apps.<cluster_name>.<domain_name>
      console-openshift-console.apps.<cluster_name>.<domain_name>
      downloads-openshift-console.apps.<cluster_name>.<domain_name>
      alertmanager-main-openshift-monitoring.apps.<cluster_name>.<domain_name>
      grafana-openshift-monitoring.apps.<cluster_name>.<domain_name>
      prometheus-k8s-openshift-monitoring.apps.<cluster_name>.<domain_name>
  2. Ingress Operator ロードバランサーのステータスを取得し、使用する外部 IP アドレスの値をメモします。これは EXTERNAL-IP 列に表示されます。

    $ oc -n openshift-ingress get service router-default
    NAME             TYPE           CLUSTER-IP      EXTERNAL-IP                            PORT(S)                      AGE
    router-default   LoadBalancer   172.30.62.215   ab3...28.us-east-2.elb.amazonaws.com   80:31499/TCP,443:30693/TCP   5m
  3. ロードバランサーのホストゾーン ID を見つけます。

    $ aws elb describe-load-balancers | jq -r '.LoadBalancerDescriptions[] | select(.DNSName == "<external_ip>").CanonicalHostedZoneNameID' 1
    
    Z3AADJGX6KTTL2
    1
    <external_ip> については、取得した Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。

    このコマンドの出力は、ロードバランサーのホストゾーン ID です。

  4. クラスターのドメインのパブリックホストゾーン ID を取得します。

    $ aws route53 list-hosted-zones-by-name \
                --dns-name "<domain_name>" \ 1
                --query 'HostedZones[? Config.PrivateZone != `true` && Name == `<domain_name>.`].Id' 2
                --output text
    
    /hostedzone/Z3URY6TWQ91KVV
    1 2
    <domain_name>については、OpenShift Container Platform クラスターの Route53 ベースドメインを指定します。

    ドメインのパブリックホストゾーン ID がコマンド出力に表示されます。この例では、これは Z3URY6TWQ91KVV になります。

  5. プライベートゾーンにエイリアスレコードを追加します。

    $ aws route53 change-resource-record-sets --hosted-zone-id "<private_hosted_zone_id>" --change-batch '{ 1
    >   "Changes": [
    >     {
    >       "Action": "CREATE",
    >       "ResourceRecordSet": {
    >         "Name": "\\052.apps.<cluster_domain>", 2
    >         "Type": "A",
    >         "AliasTarget":{
    >           "HostedZoneId": "<hosted_zone_id>", 3
    >           "DNSName": "<external_ip>.", 4
    >           "EvaluateTargetHealth": false
    >         }
    >       }
    >     }
    >   ]
    > }'
    1
    <private_hosted_zone_id> については、DNS および負荷分散の CloudFormation テンプレートの出力から値を指定します。
    2
    <cluster_domain>については、OpenShift Container Platform クラスターで使用するドメインまたはサブドメインを指定します。
    3
    <hosted_zone_id> については、取得したロードバランサーのパブリックホストゾーン ID を指定します。
    4
    <external_ip> については、Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。このパラメーターの値に末尾のピリオド (.) が含まれていることを確認します。
  6. パブリックゾーンにレコードを追加します。

    $ aws route53 change-resource-record-sets --hosted-zone-id "<public_hosted_zone_id>"" --change-batch '{ 1
    >   "Changes": [
    >     {
    >       "Action": "CREATE",
    >       "ResourceRecordSet": {
    >         "Name": "\\052.apps.<cluster_domain>", 2
    >         "Type": "A",
    >         "AliasTarget":{
    >           "HostedZoneId": "<hosted_zone_id>", 3
    >           "DNSName": "<external_ip>.", 4
    >           "EvaluateTargetHealth": false
    >         }
    >       }
    >     }
    >   ]
    > }'
    1
    <public_hosted_zone_id> については、ドメインのパブリックホストゾーンを指定します。
    2
    <cluster_domain>については、OpenShift Container Platform クラスターで使用するドメインまたはサブドメインを指定します。
    3
    <hosted_zone_id> については、取得したロードバランサーのパブリックホストゾーン ID を指定します。
    4
    <external_ip> については、Ingress Operator ロードバランサーの外部 IP アドレスの値を指定します。このパラメーターの値に末尾のピリオド (.) が含まれていることを確認します。

1.6.19. ユーザーによってプロビジョニングされるインフラストラクチャーでの AWS インストールの実行

Amazon Web Service (AWS) のユーザーによってプロビジョニングされるインフラストラクチャーで OpenShift Container Platform のインストールを開始した後に、デプロイメントを完了するまでモニターします。

前提条件

  • OpenShift Container Platform クラスターのブートストラップノードを、ユーザーによってプロビジョニングされた AWS インフラストラクチャーで削除していること。
  • oc CLI のインストールおよびログイン。

手順

  • クラスターのインストールを完了します。

    $ ./openshift-install --dir=<installation_directory> wait-for install-complete 1
    
    INFO Waiting up to 30m0s for the cluster to initialize...
    1
    <installation_directory> については、インストールファイルを保存したディレクトリーへのパスを指定します。
    重要

    インストールプログラムが生成する Ignition 設定ファイルには、24 時間が経過すると期限切れになる証明書が含まれます。最初の証明書のローテーションが正常に実行されるようにするには、クラスターを動作が低下していない状態で 24 時間実行し続ける必要があります。

    1. Cluster registration」ページでクラスターを登録します。

次のステップ

1.7. AWS でのクラスターのアンインストール

Amazon Web Services (AWS) にデプロイしたクラスターは削除することができます。

1.7.1. インストーラーでプロビジョニングされるインフラストラクチャーを使用するクラスターの削除

インストーラーでプロビジョニングされるインフラストラクチャーを使用するクラスターは、クラウドから削除できます。

前提条件

  • クラスターをデプロイするために使用したインストールプログラムのコピーがあること。
  • クラスター作成時にインストールプログラムが生成したファイルがあること。

手順

  1. クラスターをインストールするために使用したコンピューターから、以下のコマンドを実行します。

    $ ./openshift-install destroy cluster \
    --dir=<installation_directory> --log-level=info 1 2
    1
    <installation_directory> には、インストールファイルを保存したディレクトリーへのパスを指定します。
    2
    異なる詳細情報を表示するには、 info ではなく、warndebug、または error を指定します。
    注記

    クラスターのクラスター定義ファイルが含まれるディレクトリーを指定する必要があります。クラスターを削除するには、インストールプログラムでこのディレクトリーにある metadata.json ファイルが必要になります。

  2. オプション: <installation_directory> ディレクトリーおよび OpenShift Container Platform インストールプログラムを削除します。

法律上の通知

Copyright © 2020 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.