13.3. Nutanix のインストール後の設定


以下の手順に従って、OpenShift Container Platform と Nutanix クラウドプロバイダーとの統合を完了して検証します。

前提条件

  • Assisted Installer によってクラスターが正常にインストールされている。
  • クラスターが console.redhat.com に接続されている。
  • Red Hat OpenShift Container Platform コマンドラインインターフェイスにアクセスできる。

13.3.1. Nutanix 設定の更新

Assisted Installer を使用して OpenShift Container Platform を Nutanix プラットフォームにインストールした後、以下の Nutanix 設定を手動で更新する必要があります。

  • <prismcentral_username&gt;: Nutanix Prism Central のユーザー名。
  • <prismcentral_password& gt;: Nutanix Prism Central のパスワード。
  • <prismcentral_address>: Nutanix Prism Central の IP アドレス。
  • <prismcentral_port>: Nutanix Prism Central のポート。
  • <prismelement_username&gt;: Nutanix Prism Element のユーザー名。
  • <prismelement_password& gt;: Nutanix Prism Element のパスワード。
  • <prismelement_address>: Nutanix Prism Element の IP アドレス。
  • <prismelement_port>: Nutanix Prism Element のポート。
  • <prismelement_clustername>: Nutanix Prism Element のクラスター名。
  • <nutanix_storage_container& gt; : Nutanix Prism ストレージコンテナー。

手順

  1. OpenShift Container Platform コマンドラインインターフェイスで、Nutanix クラスター設定を更新します。

    $ oc patch infrastructure/cluster --type=merge --patch-file=/dev/stdin <<-EOF
    {
      "spec": {
        "platformSpec": {
          "nutanix": {
            "prismCentral": {
              "address": "<prismcentral_address>",
              "port": <prismcentral_port>
            },
            "prismElements": [
              {
                "endpoint": {
                  "address": "<prismelement_address>",
                  "port": <prismelement_port>
                },
                "name": "<prismelement_clustername>"
              }
            ]
          },
          "type": "Nutanix"
        }
      }
    }
    EOF

    出力例

    infrastructure.config.openshift.io/cluster patched

    詳細は、Nutanix でマシンセットを作成する を参照してください。

  2. Nutanix シークレットを作成します。

    $ cat <<EOF | oc create -f -
    apiVersion: v1
    kind: Secret
    metadata:
       name: nutanix-credentials
       namespace: openshift-machine-api
    type: Opaque
    stringData:
      credentials: |
    [{"type":"basic_auth","data":{"prismCentral":{"username":"${<prismcentral_username>}","password":"${<prismcentral_password>}"},"prismElements":null}}]
    EOF

    出力例

    secret/nutanix-credentials created

  3. OpenShift Container Platform バージョン 4.13 以降をインストールする場合は、Nutanix クラウドプロバイダー設定を更新します。

    1. Nutanix クラウドプロバイダー設定の YAML ファイルを取得します。

      $ oc get cm cloud-provider-config -o yaml -n openshift-config > cloud-provider-config-backup.yaml
    2. 設定ファイルのバックアップを作成します。

      $ cp cloud-provider-config_backup.yaml cloud-provider-config.yaml
    3. 設定 YAML ファイルを開きます。

      $ vi cloud-provider-config.yaml
    4. 以下のように設定 YAML ファイルを編集します。

      kind: ConfigMap
      apiVersion: v1
      metadata:
        name: cloud-provider-config
        namespace: openshift-config
      data:
        config: |
          {
          	"prismCentral": {
          		"address": "<prismcentral_address>",
          		"port":<prismcentral_port>,
          		"credentialRef": {
          		   "kind": "Secret",
          		   "name": "nutanix-credentials",
          		   "namespace": "openshift-cloud-controller-manager"
          		}
          	},
          	"topologyDiscovery": {
          		"type": "Prism",
          		"topologyCategories": null
          	},
          	"enableCustomLabeling": true
          }
    5. 設定の更新を適用します。

      $ oc apply -f cloud-provider-config.yaml

      出力例

      Warning: resource configmaps/cloud-provider-config is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by oc apply. oc apply should only be used on resources created declaratively by either oc create --save-config or oc apply. The missing annotation will be patched automatically.
      
      configmap/cloud-provider-config configured

13.3.2. Nutanix CSI Operator グループの作成

Nutanix CSI Operator の Operator グループを作成します。

注記

Operator グループと関連概念の説明は、Additional ResourcesCommon Operator Framework Terms を参照してください。

手順

  1. Nutanix CSI Operator Group YAML ファイルを開きます。

    $ vi openshift-cluster-csi-drivers-operator-group.yaml
  2. YAML ファイルを次のように編集します。

    apiVersion: operators.coreos.com/v1
    kind: OperatorGroup
    metadata:
      generateName: openshift-cluster-csi-drivers
      namespace: openshift-cluster-csi-drivers
    spec:
      targetNamespaces:
      - openshift-cluster-csi-drivers
      upgradeStrategy: Default
  3. Operator グループを作成します。

    $ oc create -f openshift-cluster-csi-drivers-operator-group.yaml

    出力例

    operatorgroup.operators.coreos.com/openshift-cluster-csi-driversjw9cd created

13.3.3. Nutanix CSI Operator のインストール

Kubernetes 用の Nutanix Container Storage Interface (CSI) Operator は、Nutanix CSI ドライバーをデプロイして管理します。

注記

Red Hat OpenShift Container Platform を介してこの手順を実行する方法については、Additional ResourcesInstalling the Operator section of the Nutanix CSI Operator を参照してください。

手順

  1. Nutanix CSI Operator YAML ファイルのパラメーター値を取得します。

    1. Nutanix CSI Operator が存在することを確認します。

      $ oc get packagemanifests | grep nutanix

      出力例

      nutanixcsioperator   Certified Operators   129m

    2. Operator のデフォルトチャネルを BASH 変数に割り当てます。

      $ DEFAULT_CHANNEL=$(oc get packagemanifests nutanixcsioperator -o jsonpath={.status.defaultChannel})
    3. Operator の起動クラスターサービスバージョン(CSV)を BASH 変数に割り当てます。

      $ STARTING_CSV=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.channels[*].currentCSV\})
    4. サブスクリプションのカタログソースを BASH 変数に割り当てます。

      $ CATALOG_SOURCE=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.catalogSource\})
    5. Nutanix CSI Operator ソース namespace を BASH 変数に割り当てます。

      $ SOURCE_NAMESPACE=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.catalogSourceNamespace\})
  2. BASH 変数を使用して Nutanix CSI Operator YAML ファイルを作成します。

    $ cat << EOF > nutanixcsioperator.yaml
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: nutanixcsioperator
      namespace: openshift-cluster-csi-drivers
    spec:
      channel: $DEFAULT_CHANNEL
      installPlanApproval: Automatic
      name: nutanixcsioperator
      source: $CATALOG_SOURCE
      sourceNamespace: $SOURCE_NAMESPACE
      startingCSV: $STARTING_CSV
    EOF
  3. CSI Nutanix Operator を作成します。

    $ oc apply -f nutanixcsioperator.yaml

    出力例

    subscription.operators.coreos.com/nutanixcsioperator created

  4. Operator サブスクリプションの状態が AtLatestKnown に変わるまで、以下のコマンドを実行します。これは、Operator サブスクリプションが作成されたことを示し、時間がかかる場合があります。

    $ oc get subscription nutanixcsioperator -n openshift-cluster-csi-drivers -o 'jsonpath={..status.state}'

13.3.4. Nutanix CSI ストレージドライバーのデプロイ

Kubernetes 用の Nutanix Container Storage Interface (CSI)ドライバーは、ステートフルアプリケーションに対してスケーラブルで永続ストレージを提供します。

注記

Red Hat OpenShift Container Platform を介してこの手順を実行する方法については、Additional ResourcesInstalling the CSI Driver using the Nutanix CSI Operator を参照してください。

手順

  1. NutanixCsiStorage リソースを作成して、ドライバーをデプロイします。

    $ cat <<EOF | oc create -f -
    apiVersion: crd.nutanix.com/v1alpha1
    kind: NutanixCsiStorage
    metadata:
      name: nutanixcsistorage
      namespace: openshift-cluster-csi-drivers
    spec: {}
    EOF

    出力例

    snutanixcsistorage.crd.nutanix.com/nutanixcsistorage created

  2. CSI ストレージドライバーの Nutanix シークレット YAML ファイルを作成します。

    $ cat <<EOF | oc create -f -
    apiVersion: v1
    kind: Secret
    metadata:
      name: ntnx-secret
      namespace: openshift-cluster-csi-drivers
    stringData:
      # prism-element-ip:prism-port:admin:password
      key: <prismelement_address:prismelement_port:prismcentral_username:prismcentral_password> 1
    EOF
    注記
    1
    同じ形式を維持しつつ、これらのパラメーターを実際の値に置き換えます。

    出力例

    secret/nutanix-secret created

13.3.5. インストール後の設定の検証

以下のコマンドを実行して設定を検証します。

手順

  1. ストレージクラスを作成できることを確認します。

    $ cat <<EOF | oc create -f -
    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: nutanix-volume
      annotations:
        storageclass.kubernetes.io/is-default-class: 'true'
    provisioner: csi.nutanix.com
    parameters:
      csi.storage.k8s.io/fstype: ext4
      csi.storage.k8s.io/provisioner-secret-namespace: openshift-cluster-csi-drivers
      csi.storage.k8s.io/provisioner-secret-name: ntnx-secret
      storageContainer: <nutanix_storage_container> 1
      csi.storage.k8s.io/controller-expand-secret-name: ntnx-secret
      csi.storage.k8s.io/node-publish-secret-namespace: openshift-cluster-csi-drivers
      storageType: NutanixVolumes
      csi.storage.k8s.io/node-publish-secret-name: ntnx-secret
      csi.storage.k8s.io/controller-expand-secret-namespace: openshift-cluster-csi-drivers
    reclaimPolicy: Delete
    allowVolumeExpansion: true
    volumeBindingMode: Immediate
    EOF
    注記
    1
    Nutanix 設定から <nutanix_storage_container> を取ります(例:SelfServiceContainer)。

    出力例

    storageclass.storage.k8s.io/nutanix-volume created

  2. Nutanix 永続ボリューム要求(PVC)を作成できることを確認します。

    1. Persistent Volume Claim (永続ボリューム要求) の作成

      $ cat <<EOF | oc create -f -
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
        name: nutanix-volume-pvc
        namespace: openshift-cluster-csi-drivers
        annotations:
          volume.beta.kubernetes.io/storage-provisioner: csi.nutanix.com
          volume.kubernetes.io/storage-provisioner: csi.nutanix.com
        finalizers:
          - kubernetes.io/pvc-protection
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
        storageClassName: nutanix-volume
        volumeMode: Filesystem
      EOF

      出力例

      persistentvolumeclaim/nutanix-volume-pvc created

    2. 永続ボリューム要求(PVC)ステータスが Bound であることを確認します。

      $ oc get pvc -n openshift-cluster-csi-drivers

      出力例

      NAME                 STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS     AGE
      nutanix-volume-pvc   Bound                                        nutanix-volume   52s

関連情報

Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.