3.8. 为 Nutanix 配置 IAM
安装集群需要 Cloud Credential Operator(CCO)以手动模式运行。虽然安装程序为手动模式配置 CCO,您必须指定身份和访问管理 secret。
先决条件
-
您已配置了
ccoctl
二进制文件。 -
您有一个
install-config.yaml
文件。
流程
按照以下格式创建一个包含凭证数据的 YAML 文件:
凭证数据格式
credentials: - type: basic_auth 1 data: prismCentral: 2 username: <username_for_prism_central> password: <password_for_prism_central> prismElements: 3 - name: <name_of_prism_element> username: <username_for_prism_element> password: <password_for_prism_element>
运行以下命令,使用安装文件中的发行镜像设置
$RELEASE_IMAGE
变量:$ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')
运行以下命令,从 OpenShift Container Platform 发行镜像中提取
CredentialsRequest
自定义资源 (CR) 列表:$ oc adm release extract \ --from=$RELEASE_IMAGE \ --credentials-requests \ --included \1 --install-config=<path_to_directory_with_installation_configuration>/install-config.yaml \2 --to=<path_to_directory_for_credentials_requests> 3
CredentialsRequest
对象示例apiVersion: cloudcredential.openshift.io/v1 kind: CredentialsRequest metadata: annotations: include.release.openshift.io/self-managed-high-availability: "true" labels: controller-tools.k8s.io: "1.0" name: openshift-machine-api-nutanix namespace: openshift-cloud-credential-operator spec: providerSpec: apiVersion: cloudcredential.openshift.io/v1 kind: NutanixProviderSpec secretRef: name: nutanix-credentials namespace: openshift-machine-api
运行以下命令,使用
ccoctl
工具处理所有CredentialsRequest
对象:$ ccoctl nutanix create-shared-secrets \ --credentials-requests-dir=<path_to_credentials_requests_directory> \1 --output-dir=<ccoctl_output_dir> \2 --credentials-source-filepath=<path_to_credentials_file> 3
编辑
install-config.yaml
配置文件,使credentialsMode
参数设置为Manual
。install-config.yaml
配置文件示例apiVersion: v1 baseDomain: cluster1.example.com credentialsMode: Manual 1 ...
- 1
- 添加这一行,将
credentialsMode
参数设置为Manual
。
运行以下命令来创建安装清单:
$ openshift-install create manifests --dir <installation_directory> 1
- 1
- 指定包含集群的
install-config.yaml
文件的目录路径。
运行以下命令,将生成的凭证文件复制到目标清单目录中:
$ cp <ccoctl_output_dir>/manifests/*credentials.yaml ./<installation_directory>/manifests
验证
确保
manifests
目录中存在适当的 secret。$ ls ./<installation_directory>/manifests
输出示例
cluster-config.yaml cluster-dns-02-config.yml cluster-infrastructure-02-config.yml cluster-ingress-02-config.yml cluster-network-01-crd.yml cluster-network-02-config.yml cluster-proxy-01-config.yaml cluster-scheduler-02-config.yml cvo-overrides.yaml kube-cloud-config.yaml kube-system-configmap-root-ca.yaml machine-config-server-tls-secret.yaml openshift-config-secret-pull-secret.yaml openshift-cloud-controller-manager-nutanix-credentials-credentials.yaml openshift-machine-api-nutanix-credentials-credentials.yaml