搜索

3.9. 为 Nutanix 配置 IAM

download PDF

安装集群需要 Cloud Credential Operator(CCO)以手动模式运行。虽然安装程序为手动模式配置 CCO,您必须指定身份和访问管理 secret。

先决条件

  • 您已配置了 ccoctl 二进制文件。
  • 您有一个 install-config.yaml 文件。

流程

  1. 按照以下格式创建一个包含凭证数据的 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>

    1
    指定身份验证类型。仅支持基本身份验证。
    2
    指定 Prism Central 凭证。
    3
    可选:指定 Prism Element 凭证。
  2. 运行以下命令,使用安装文件中的发行镜像设置 $RELEASE_IMAGE 变量:

    $ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')
  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
    1
    --included 参数仅包含特定集群配置所需的清单。
    2
    指定 install-config.yaml 文件的位置。
    3
    指定要存储 CredentialsRequest 对象的目录的路径。如果指定的目录不存在,这个命令会创建它。

    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

  4. 运行以下命令,使用 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
    1
    指定包含组件 CredentialsRequests 对象文件的目录路径。
    2
    可选:指定您希望 ccoctl 实用程序在其中创建对象的目录。默认情况下,实用程序在运行命令的目录中创建对象。
    3
    可选:指定包含凭证数据 YAML 文件的目录。默认情况下,ccoctl 预期此文件位于 <home_directory>/.nutanix/credentials 中。
  5. 编辑 install-config.yaml 配置文件,使 credentialsMode 参数设置为 Manual

    install-config.yaml 配置文件示例

    apiVersion: v1
    baseDomain: cluster1.example.com
    credentialsMode: Manual 1
    ...

    1
    添加这一行,将 credentialsMode 参数设置为 Manual
  6. 运行以下命令来创建安装清单:

    $ openshift-install create manifests --dir <installation_directory> 1
    1
    指定包含集群的 install-config.yaml 文件的目录路径。
  7. 运行以下命令,将生成的凭证文件复制到目标清单目录中:

    $ 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

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.