LoginSignup
2
0

More than 1 year has passed since last update.

Red Hat OpenShift Service on AWSのPersistentVolumeとしてAmazon FSx for NetApp ONTAPを使ってみた(ROSAクラスタのデプロイ編)

Last updated at Posted at 2023-02-06

はじめに

  • Red Hat社が提供するKubernetesのディストリビューションとして、エンタープライズな領域を中心によく使われている印象がある(やっぱ保守受けたいですよね、わかります)、Red Hat OpenShift Container Platform(OCP)。
  • そのOCPの、AWSによるマネージドサービスがRed Hat OpenShift Service on AWS(ROSA)。
  • そのROSAとAmazon FSx for NetApp ONTAP(FSx for ONTAP)との統合について紹介されているAWSブログを読んで、興味が湧いてきたので自分でも試してみました。
  • ちなみにOpenShift自体は少し触れたことがありますが、ROSA自体に触れるは全くの初めてです。
  • 長くなりそうなので2回に分けて、まずはROSAクラスタのデプロイ編です。

Windowsで作業する場合の手順です。2023年2月上旬に実施していますので、今後手順等が変わったらすみません。

予め用意しておくもの

  • AWSアカウント
  • Red Hatアカウント

早速やってみた

ROSAの有効化

  • AWSマネージドコンソールのROSAの画面から「使用を開始」をクリック。
    enable_rosa1.png
  • 「連絡先情報を Red Hat と共有することに同意します。」にチェックを入れて、「ROSAを有効にする」をクリック。
    enable_rosa2.png
  • 有効になった模様。AWS Organizationsは使っていない環境なので「使用権限の付与」は無視します。
    enable_rosa3.png
  • 「Service Quotas」や「ELB サービスにリンクされたロール」は既に前提条件を満たしているようなので「Red Hatに進む」をクリック。
    enable_rosa4.png
  • ブラウザの別タブでRed Hatのログイン画面が起動したのでログイン。
    enable_rosa5.png
  • Enterprise Agreementを熟読し、「条件を読み、その内容に同意します。」にチェックを入れ、「提出」をクリック。
    enable_rosa6.png
  • 「Get started with Red Hat OpenShift Service on AWS (ROSA)」というウィザード画面が表示されたので、Step 1の「Open AWS Console」をクリック。
    enable_rosa7.png
  • ふりだしに戻ったような戻ってないような感じですが、試しに「ソフトウェア契約を購入し、既存の契約を表示する」をクリック。
    enable_rosa8.png
  • 割安の1年間前払いの契約を購入できる模様。今回は従量課金で利用したいのでキャンセル。
    enable_rosa9.png
  • Red Hatの画面に戻って、Step 2のROSA CLIをダウンロードして解凍。rosaコマンドを実行できることを確認。(AWS CLIはインストール済みでした。)
    enable_rosa10.png
    >rosa version
    1.2.11
    
  • Step 3のELB用のIAMロールがあるかどうかを確認。(ありました。)
    enable_rosa11.png
    >aws iam get-role --role-name "AWSServiceRoleForElasticLoadBalancing"
    {
        "Role": {
            "Path": "/aws-service-role/elasticloadbalancing.amazonaws.com/",
            "RoleName": "AWSServiceRoleForElasticLoadBalancing",
            "RoleId": "XXXXXXXXXXXXXXXXXXXXX",
            "Arn": "arn:aws:iam::XXXXXXXXXXXX:role/aws-service-role/elasticloadbalancing.amazonaws.com/AWSServiceRoleForElasticLoadBalancing",
            "CreateDate": "2019-10-07T08:48:34+00:00",
            "AssumeRolePolicyDocument": {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Principal": {
                            "Service": "elasticloadbalancing.amazonaws.com"
                        },
                        "Action": "sts:AssumeRole"
                    }
                ]
            },
            "MaxSessionDuration": 3600,
            "RoleLastUsed": {
                "LastUsedDate": "2022-06-14T08:02:54+00:00",
                "Region": "ap-northeast-1"
            }
        }
    }
    
  • Step 4のコマンドをコピペして実行し、ROSA CLIにログイン。
    enable_rosa12.png
    >rosa login --token="eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSld(略)"
    INFO: Logged in as 'xxxxxxxxx' on 'https://api.openshift.com'
    
  • アカウントロールを作成。4つのIAMロールを作成しても良いかを確認されるのですべて「Y」を入力して作成。
    >rosa create account-roles --mode auto
    INFO: Logged in as 'xxxxxxxxx' on 'https://api.openshift.com'
    INFO: Validating AWS credentials...
    INFO: AWS credentials are valid!
    INFO: Validating AWS quota...
    INFO: AWS quota ok. If cluster installation fails, validate actual AWS resource usage against https://docs.openshift.com/rosa/rosa_getting_started/rosa-required-aws-service-quotas.html
    INFO: Verifying whether OpenShift command-line tool is available...
    WARN: OpenShift command-line tool is not installed.
    Run 'rosa download oc' to download the latest version, then add it to your PATH.
    INFO: Creating account roles
    INFO: Creating roles using 'arn:aws:iam::XXXXXXXXXXXX:user/xxxxxxxxx'
    ? Create the 'ManagedOpenShift-Installer-Role' role? Yes
    INFO: Created role 'ManagedOpenShift-Installer-Role' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Installer-Role'
    ? Create the 'ManagedOpenShift-ControlPlane-Role' role? Yes
    INFO: Created role 'ManagedOpenShift-ControlPlane-Role' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-ControlPlane-Role'
    ? Create the 'ManagedOpenShift-Worker-Role' role? Yes
    INFO: Created role 'ManagedOpenShift-Worker-Role' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Worker-Role'
    ? Create the 'ManagedOpenShift-Support-Role' role? Yes
    INFO: Created role 'ManagedOpenShift-Support-Role' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Support-Role'
    INFO: To create a cluster with these roles, run the following command:
    rosa create cluster --sts
    
  • Step 5のコマンドをコピペして実行し、認証情報とクオータを確認。(問題なしでした。)
    enable_rosa13.png
    >rosa whoami
    AWS ARN:                      arn:aws:iam::XXXXXXXXXXXX:user/xxxxxxxxx
    AWS Account ID:               XXXXXXXXXXXX
    AWS Default Region:           ap-northeast-1
    OCM API:                      https://api.openshift.com
    OCM Account Email:            xxxxxxxxx@xxxxxxxxx
    OCM Account ID:               XXXXXXXXXXXXXXXXXXXXXXXXXXX
    OCM Account Name:             Seiji Tanabe
    OCM Account Username:         XXXXXXXXXXXX
    OCM Organization External ID: XXXXXXXX
    OCM Organization ID:          XXXXXXXXXXXXXXXXXXXXXXXXXXX
    OCM Organization Name:        XXXXXXXX
    
    >rosa verify quota
    INFO: Validating AWS quota...
    INFO: AWS quota ok. If cluster installation fails, validate actual AWS resource usage against 
    https://docs.openshift.com/rosa/rosa_getting_started/rosa-required-aws-service-quotas.html
    
  • ocCLIをダウンロードし、解凍してocコマンドを実行できることを確認。
    >rosa download oc
    INFO: Verifying whether OpenShift command-line tool is available...
    WARN: OpenShift command-line tool is not installed.
    Run 'rosa download oc' to download the latest version, then add it to your PATH.
    INFO: Downloading https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-windows.zip
    Downloading... 45 MB complete
    INFO: Successfully downloaded openshift-client-windows.zip
    
    >oc version
    Client Version: 4.12.1
    Kustomize Version: v4.5.7
    
  • これで準備完了。

ROSAクラスタのデプロイ

  • ROSAクラスタst-rosa-testをデプロイ。
    >rosa create cluster --cluster-name st-rosa-test --sts --mode auto --yes
    WARN: In a future release STS will be the default mode.
    WARN: --sts flag won't be necessary if you wish to use STS.
    WARN: --non-sts/--mint-mode flag will be necessary if you do not wish to use STS.
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Installer-Role for the Installer role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-ControlPlane-Role for the ControlPlane role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Worker-Role for the Worker role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Support-Role for the Support role
    INFO: Creating cluster 'st-rosa-test'
    INFO: To view a list of clusters and their status, run 'rosa list clusters'
    ERR: Failed to create cluster: You must accept the Terms and Conditions in order to continue.
    Go to https://www.redhat.com/wapps/tnc/ackrequired?site=ocm&event=register
    Once you accept the terms, you will need to retry the action that was blocked.
    
  • エラー出ました。。。利用規約に同意する必要があるらしい。
  • https://www.redhat.com/wapps/tnc/ackrequired?site=ocm&event=register にアクセスし、「条件を読み、その内容に同意します。」にチェックを入れて「提出」をクリック。
    deploy_rosa1.png
  • これでOKなはずです。
    deploy_rosa2.png
  • 気を取り直して再度トライ。うまくいったようです。
    >rosa create cluster --cluster-name st-rosa-test --sts --mode auto --yes
    WARN: In a future release STS will be the default mode.
    WARN: --sts flag won't be necessary if you wish to use STS.
    WARN: --non-sts/--mint-mode flag will be necessary if you do not wish to use STS.
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Installer-Role for the Installer role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-ControlPlane-Role for the ControlPlane role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Worker-Role for the Worker role
    INFO: Using arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Support-Role for the Support role
    INFO: Creating cluster 'st-rosa-test'
    INFO: To view a list of clusters and their status, run 'rosa list clusters'
    INFO: Cluster 'st-rosa-test' has been created.
    INFO: Once the cluster is installed you will need to add an Identity Provider before you can login into the cluster. See 'rosa create idp --help' for more information.
    
    Name:                       st-rosa-test
    ID:                         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    External ID:
    Control Plane:              Customer hosted
    OpenShift Version:
    Channel Group:              stable
    DNS:                        st-rosa-test.XXXX.XX.openshiftapps.com
    AWS Account:                XXXXXXXXXXXX
    API URL:
    Console URL:
    Region:                     ap-northeast-1
    Multi-AZ:                   false
    Nodes:
     - Control plane:           3
     - Infra:                   2
     - Compute:                 2
    Network:
     - Type:                    OVNKubernetes
     - Service CIDR:            172.30.0.0/16
     - Machine CIDR:            10.0.0.0/16
     - Pod CIDR:                10.128.0.0/14
     - Host Prefix:             /23
    STS Role ARN:               
    arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Installer-Role
    Support Role ARN:           
    arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Support-Role
    Instance IAM Roles:
     - Control plane:           
    arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-ControlPlane-Role
     - Worker:                  
    arn:aws:iam::XXXXXXXXXXXX:role/ManagedOpenShift-Worker-Role
    Operator IAM Roles:
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cloud-network-config-controller-clou
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-machine-api-aws-cloud-credentials
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cloud-credential-operator-cloud-cred
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-image-registry-installer-cloud-crede
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-ingress-operator-cloud-credentials
     - arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cluster-csi-drivers-ebs-cloud-creden
    State:                      waiting (Waiting for OIDC configuration)
    Private:                    No
    Created:                    Feb  4 2023 12:34:47 UTC
    Details Page:               
    https://console.redhat.com/openshift/details/s/XXXXXXXXXXXXXXXXXXXXXXXXXXX
    OIDC Endpoint URL:          https://rh-oidc.s3.us-east-1.amazonaws.com/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    
    INFO: Preparing to create operator roles.
    INFO: Creating roles using 
    'arn:aws:iam::XXXXXXXXXXXX:user/xxxxxxxxx'
    INFO: Created role 'st-rosa-test-p3x9-openshift-ingress-operator-cloud-credentials' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-ingress-operator-cloud-credentials'
    INFO: Created role 'st-rosa-test-p3x9-openshift-cluster-csi-drivers-ebs-cloud-creden' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cluster-csi-drivers-ebs-cloud-creden'
    INFO: Created role 'st-rosa-test-p3x9-openshift-cloud-network-config-controller-clou' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cloud-network-config-controller-clou'
    INFO: Created role 'st-rosa-test-p3x9-openshift-machine-api-aws-cloud-credentials' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-machine-api-aws-cloud-credentials'
    INFO: Created role 'st-rosa-test-p3x9-openshift-cloud-credential-operator-cloud-cred' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-cloud-credential-operator-cloud-cred'
    INFO: Created role 'st-rosa-test-p3x9-openshift-image-registry-installer-cloud-crede' with ARN 'arn:aws:iam::XXXXXXXXXXXX:role/st-rosa-test-p3x9-openshift-image-registry-installer-cloud-crede'
    INFO: Preparing to create OIDC Provider.
    INFO: Creating OIDC provider using 
    'arn:aws:iam::XXXXXXXXXXXX:user/xxxxxxxxx'
    INFO: Created OIDC provider with ARN 'arn:aws:iam::XXXXXXXXXXXX:oidc-provider/rh-oidc.s3.us-east- 1.amazonaws.com/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    INFO: To determine when your cluster is Ready, run 'rosa describe cluster -c st-rosa-test'.
    INFO: To watch your cluster installation logs, run 'rosa logs install -c st-rosa-test --watch'.
    
  • ROSAクラスタ一覧を確認すると、st-rosa-testがインストール中となっています。
    >rosa list cluster
    ID                                NAME          STATE
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  st-rosa-test  installing
    
  • Red Hat Hybrid Cloud Consoleを確認すると、インストール中のクラスタが表示されています。「st-rosa-test」をクリック。
    deploy_rosa3.png
  • しばらく待ちます。
    deploy_rosa4.png
  • 30分強ほどでクラスタがreadyになりました。
    >rosa list cluster
    ID                                NAME          STATE
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX  st-rosa-test  ready
    
  • Red Hat Hybrid Cloud Console側はこんな感じです。Infra Nodeが0なのが気になります。
    deploy_rosa6.png
  • AWSマネジメントコンソールを見てみます。まずはVPC。ROSAクラスタ用のVPCが自動作成されていました。
    deploy_rosa5.png
  • そしてEC2を見てみると、Master Nodeが3台、Infra Nodeが2台、Worker Nodeが2台作成されていました。Infra Nodeもありますね。(まあまあ大きめのインスタンスサイズで作成されるので、検証する際のコストは要注意です。)
    deploy_rosa7.png
  • ちなみにAWSマネジメントコンソール側のROSAはこの画面のままなので、完全にRed Hat側で管理する形になるようです。知りませんでした。結構驚きです。
    enable_rosa8.png
  • しばらくするとInfra Nodeも2/2になっていました。やや時間差があるようです。
    deploy_rosa8.png

ROSAユーザー設定

  • 管理者ユーザーを作成。
    >rosa create admin --cluster=st-rosa-test
    I: Admin account has been added to cluster 'st-rosa-test'.
    I: Please securely store this generated password. If you lose this  password you can delete and recreate the cluster admin user.
    I: To login, run the following command:
    
       oc login https://api.st-rosa-test.XXXX.XX.openshiftapps.com:6443 --username cluster-admin --password XXXXXXXXXXXXXXXXXXXXXXX
    
    I: It may take several minutes for this access to become active.
    
  • ROSAクラスタへログイン。
    >oc login https://api.st-rosa-test.XXXX.XX.openshiftapps.com:6443 --username cluster-admin --password XXXXXXXXXXXXXXXXXXXXXXX
    Login successful.
    
    You have access to 101 projects, the list has been suppressed. You can list all projects with 'oc projects'
    
    Using project "default".
    Welcome! See 'oc help' to get started.
    
  • GUIでもログインしてみるとこんな感じです。
     deploy_rosa9.png
  • というわけで、これでROSAのデプロイは完了です。

まとめと次回予告

  • 無事にROSAクラスタをデプロイできました。
  • 今回初めてROSAを触ってみましたが、AWSのサービスなのにAWS側でやる作業がほぼ無く、AWSマネジメントコンソールで管理しないのが新鮮でした。
  • デプロイするだけならAWSのインフラをほぼ意識する必要がなく、OpenShiftのコンソールに完全に統合されているので、ROSAも他の(例えばオンプレミスの)OpenShiftクラスタと同じように管理できるのは既存OpenShiftユーザーにとってはいいなと思いました。
  • 次回はFSx for ONTAPをデプロイして、ROSA上で動くコンテナのPVとしてマウントしてみます。乞うご期待!
  • (2023/2/8 追記:次回「FSx for ONTAPのデプロイ・マウント編」公開しました。)

参照記事

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0