12.3. Nutanix のインストール後の設定
OpenShift Container Platform と Nutanix クラウドプロバイダーの統合を完了し、検証します。
デフォルトでは、インストールプログラムは Red Hat Enterprise Linux CoreOS (RHCOS) イメージをダウンロードしてインストールします。Prism Central がインターネットにアクセスできない場合は、任意の HTTP サーバーで RHCOS イメージをホストし、インストールプログラムがイメージを指すようにするか、Prism Central を使用してイメージを手動でアップロードできます。
12.3.1. Nutanix 設定の更新 リンクのコピーリンクがクリップボードにコピーされました!
Assisted Installer を使用して Nutanix プラットフォームに OpenShift Container Platform をインストールした後、次の Nutanix 設定を手動で更新します。
前提条件
- Nutanix Prism Element のユーザー名がある。
- Nutanix Prism Element のパスワードがある。
- Nutanix Prism ストレージコンテナーがある。
- Assisted Installer によってクラスターのインストールを正常に完了した。
- クラスターを console.redhat.com に接続した。
- Red Hat OpenShift Container Platform コマンドラインインターフェイスにアクセスできる。
手順
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-
<prismcentral_address>は、Nutanix Prism Central のアドレスに置き換えます。 -
<prismcentral_port>は、Nutanix Prism Central のポートに置き換えます。 -
<prismelement_address>は、Nutanix Prism Element のアドレスに置き換えます。 -
<prismelement_port>は、Nutanix Prism Element のポートに置き換えます。 -
<prismelement_clustername>は、Nutanix Prism Element のクラスター名に置き換えます。
出力例
infrastructure.config.openshift.io/cluster patched詳細は、Nutanix でコンピュートマシンセットを作成する を参照してください。
注記オプション: prism カテゴリーのキーと値のペアを定義できます。これらのカテゴリーのキーと値のペアは、Prism Central に存在する必要があります。コンピュートノード、コントロールプレーンノード、またはすべてのノードごとに異なるカテゴリーのキーと値のペアを定義できます。
-
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-
<prismcentral_username>は、Nutanix Prism Central のユーザー名に置き換えます。 -
<prismcentral_password>は、Nutanix Prism Central のパスワードに置き換えます。
出力例
secret/nutanix-credentials created-
OpenShift Container Platform バージョン 4.13 以降をインストールする場合は、Nutanix クラウドプロバイダー設定を更新します。
Nutanix クラウドプロバイダー設定 YAML ファイルを取得します。
$ oc get cm cloud-provider-config -o yaml -n openshift-config > cloud-provider-config-backup.yaml設定ファイルのバックアップを作成します。
$ cp cloud-provider-config_backup.yaml cloud-provider-config.yaml設定 YAML ファイルを開きます。
$ vi cloud-provider-config.yaml以下のように設定 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 }設定の更新を適用します。
$ 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
12.3.2. Nutanix CSI Operator グループの作成 リンクのコピーリンクがクリップボードにコピーされました!
Nutanix CSI Operator の Operator グループを作成します。
Operator グループと関連する概念の説明については、Operator について を参照してください。
前提条件
- Nutanix の設定を更新した。
手順
Nutanix CSI Operator Group YAML ファイルを開きます。
$ vi openshift-cluster-csi-drivers-operator-group.yamlYAML ファイルを次のように編集します。
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: DefaultOperator グループを作成します。
$ oc create -f openshift-cluster-csi-drivers-operator-group.yaml出力例
operatorgroup.operators.coreos.com/openshift-cluster-csi-driversjw9cd created
12.3.3. Nutanix CSI Operator のインストール リンクのコピーリンクがクリップボードにコピーされました!
Nutanix Container Storage Interface (CSI) Operator for Kubernetes は、Nutanix CSI ドライバーをデプロイおよび管理します。
OpenShift Container Platform Web コンソールからこのステップを実行する手順については、Nutanix CSI Operator ドキュメントの Installing the Operator セクションを参照してください。
前提条件
- Nutanix CSI Operator グループを作成した。
手順
Nutanix CSI Operator YAML ファイルのパラメーター値を取得します。
Nutanix CSI Operator が存在することを確認します。
$ oc get packagemanifests | grep nutanix出力例
nutanixcsioperator Certified Operators 129mOperator のデフォルトチャネルを BASH 変数に割り当てます。
$ DEFAULT_CHANNEL=$(oc get packagemanifests nutanixcsioperator -o jsonpath={.status.defaultChannel})Operator の開始クラスターサービスバージョン (CSV) を BASH 変数に割り当てます。
$ STARTING_CSV=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.channels[*].currentCSV\})サブスクリプションのカタログソースを BASH 変数に割り当てます。
$ CATALOG_SOURCE=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.catalogSource\})Nutanix CSI Operator ソース namespace を BASH 変数に割り当てます。
$ SOURCE_NAMESPACE=$(oc get packagemanifests nutanixcsioperator -o jsonpath=\{.status.catalogSourceNamespace\})
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 EOFCSI Nutanix Operator を作成します。
$ oc apply -f nutanixcsioperator.yaml出力例
subscription.operators.coreos.com/nutanixcsioperator createdOperator サブスクリプションの状態が
AtLatestKnownに変わるまで、以下のコマンドを実行します。この状態は、Operator サブスクリプションが作成されたことを示します。これには時間がかかる場合があります。$ oc get subscription nutanixcsioperator -n openshift-cluster-csi-drivers -o 'jsonpath={..status.state}'
12.3.4. Nutanix CSI ストレージドライバーのデプロイ リンクのコピーリンクがクリップボードにコピーされました!
Nutanix Container Storage Interface (CSI) Driver for Kubernetes は、ステートフルアプリケーションにスケーラブルで永続的なストレージを提供します。
OpenShift Container Platform Web コンソールからこのステップを実行する手順については、Nutanix CSI Operator ドキュメントの Installing the CSI Driver using the Operator セクションを参照してください。
前提条件
- Nutanix CSI Operator をインストールした。
手順
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 createdCSI ストレージドライバーの 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> EOF同じ形式を維持しながら、
keyパラメーターを実際の値に置き換えます。出力例
secret/nutanix-secret created
12.3.5. インストール後の設定の検証 リンクのコピーリンクがクリップボードにコピーされました!
ストレージクラスとバインドされた永続ボリューム要求を作成できることを確認します。
前提条件
- Nutanix CSI ストレージドライバーをデプロイした。
手順
ストレージクラスを作成できることを確認します。
$ 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> 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注記Nutanix 設定から <
nutanix_storage_container> を取ります(例:SelfServiceContainer)。出力例
storageclass.storage.k8s.io/nutanix-volume createdNutanix 永続ボリューム要求 (PVC) を作成できることを確認します。
永続ボリューム要求 (PVC) を作成します。
$ 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永続ボリューム要求 (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