要使用用户置备的基础架构安装 OpenShift 集群,请按照 Redhat OpenShift 文档中的说明进行操作。
这是安装 OpenShift 集群的两种方法之一。另一种方法是使用安装程序置备的基础架构安装集群(请参见使用安装程序置备的基础架构安装 OpenShift 4)。您只能使用这两种方法之一。
您可以在 https://docs.openshift.com/container-platform/4.7/installing/installing_vsphere/installing-vsphere.html 找到此文档。
install-config.yaml 的示例:
apiVersion: v1
baseDomain: yasen.local
compute:
- hyperthreading: Enabled
name: worker
replicas: 0
controlPlane:
hyperthreading: Enabled
name: master
replicas: 3
metadata:
name: ocp
networking:
networkType: ncp
clusterNetwork:
- cidr: 10.4.0.0/16
hostPrefix: 23
machineCIDR: 10.114.16.0/24
serviceNetwork:
- 172.30.0.0/16
platform:
vsphere:
vcenter: vc.yasen.local
username: administrator@yasen.local
password: VMware1!
datacenter: Datacenter1
defaultDatastore: NFS
pullSecret: ''
sshKey: 'ssh-rsa xxxx'
请确保将 networkType 设置为 ncp(区分大小写),并将 cidr 设置为所需的子网。
按照 OpenShift 安装说明进行操作,您需要将 nsx-container-plugin-operator/deploy 的内容复制到 <installation_directory>/manifests 文件夹,然后生成 ignition-configs。
要生成清单,请运行以下命令:
$ ./openshift-install create manifests --dir=<installation_directory>
要将 NCP 网络 Operator YAML 文件复制到
manifests 文件夹中,请运行以下命令:
$ cp nsx-container-plugin-operator/deploy/*.yaml <installation_directory>/manifests
要生成
ignition-configs,请运行以下命令:
$ ./openshift-install create ignition-configs --dir=<installation_directory>
将 DDNS 与 OpenShift 节点结合使用
您可以将 DDNS 与运行 CoreOS 的 OpenShift 节点结合使用。当 nsx-ovs 容器运行时,它会停止使用 DHCP 的主机上的活动连接,然后从中克隆新的连接,并在现有连接名称前面附加“NSX”。此 NSX 连接具有来自原始连接的动态 IP 信息(地址、网关、DNS 和域)的 IP 配置。将在容器内启动新的 DHCP 客户端以维护和续订租约。如果在 nsx-ovs 运行时 DNS 或域名发生更改,则会退出并重新启动。这样做是为了确保先通过 NetworkManager,然后再通过 nsx-ovs 获取 IP 信息。在 NSX 连接处于活动状态时无法覆盖其属性。