第 7 章 创建集群
了解如何使用 Red Hat Advanced Cluster Management for Kubernetes 跨云供应商创建 Red Hat OpenShift Container Platform 集群。
7.1. 在集群创建过程中配置额外清单
您可以在创建集群的过程中配置额外的 Kubernetes 资源清单。如果您需要为配置网络或设置负载均衡器等场景配置额外清单,这可以提供帮助。
在创建集群前,您需要添加对 ClusterDeployment
资源的引用,该资源指定包含其他资源清单的 ConfigMap
。
注: ClusterDeployment
资源和 ConfigMap
必须位于同一命名空间中。以下示例演示了您的内容看起来如何。
带有资源清单的 ConfigMap
包含具有另一个
ConfigMap
资源的清单的ConfigMap
。资源清单ConfigMap
可以包含多个键,并在data.<resource_name>\.yaml
模式中添加资源配置。kind: ConfigMap apiVersion: v1 metadata: name: <my-baremetal-cluster-install-manifests> namespace: <mynamespace> data: 99_metal3-config.yaml: | kind: ConfigMap apiVersion: v1 metadata: name: metal3-config namespace: openshift-machine-api data: http_port: "6180" provisioning_interface: "enp1s0" provisioning_ip: "172.00.0.3/24" dhcp_range: "172.00.0.10,172.00.0.100" deploy_kernel_url: "http://172.00.0.3:6180/images/ironic-python-agent.kernel" deploy_ramdisk_url: "http://172.00.0.3:6180/images/ironic-python-agent.initramfs" ironic_endpoint: "http://172.00.0.3:6385/v1/" ironic_inspector_endpoint: "http://172.00.0.3:5150/v1/" cache_url: "http://192.168.111.1/images" rhcos_image_url: "https://releases-art-rhcos.svc.ci.openshift.org/art/storage/releases/rhcos-4.3/43.81.201911192044.0/x86_64/rhcos-43.81.201911192044.0-openstack.x86_64.qcow2.gz"
使用引用的资源清单
ConfigMap
的 ClusterDeployment资源清单
ConfigMap
在spec.provisioning.manifestsConfigMapRef
下引用。apiVersion: hive.openshift.io/v1 kind: ClusterDeployment metadata: name: <my-baremetal-cluster> namespace: <mynamespace> annotations: hive.openshift.io/try-install-once: "true" spec: baseDomain: test.example.com clusterName: <my-baremetal-cluster> controlPlaneConfig: servingCertificates: {} platform: baremetal: libvirtSSHPrivateKeySecretRef: name: provisioning-host-ssh-private-key provisioning: installConfigSecretRef: name: <my-baremetal-cluster-install-config> sshPrivateKeySecretRef: name: <my-baremetal-hosts-ssh-private-key> manifestsConfigMapRef: name: <my-baremetal-cluster-install-manifests> imageSetRef: name: <my-clusterimageset> sshKnownHosts: - "10.1.8.90 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXvVVVKUYVkuyvkuygkuyTCYTytfkufTYAAAAIbmlzdHAyNTYAAABBBKWjJRzeUVuZs4yxSy4eu45xiANFIIbwE3e1aPzGD58x/NX7Yf+S8eFKq4RrsfSaK2hVJyJjvVIhUsU9z2sBJP8=" pullSecretRef: name: <my-baremetal-cluster-pull-secret>