5.2.2. 单个 Master、多个 etcd 和多个节点
下表描述了单个 master、三个 etcd 主机、两个用于托管用户应用程序的节点,以及两个具有 node-role.kubernetes.io/infra=true 标签的节点:
| 主机名 | 安装的组件/角色 |
|---|---|
| master.example.com | Master 和节点 |
| etcd1.example.com | etcd |
| etcd2.example.com | |
| etcd3.example.com | |
| node1.example.com | Compute 节点 |
| node2.example.com | |
| infra-node1.example.com | 专用基础架构节点 |
| infra-node2.example.com |
您可以看到以下清单文件的 [masters]、[nodes] 和 [etcd] 部分中出现的这些示例主机:
单个 Master、多个 etcd 和多节点清单文件
# Create an OSEv3 group that contains the masters, nodes, and etcd groups
[OSEv3:children]
masters
nodes
etcd
# Set variables common for all OSEv3 hosts
[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=openshift-enterprise
# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
# host group for masters
[masters]
master.example.com
# host group for etcd
[etcd]
etcd1.example.com
etcd2.example.com
etcd3.example.com
# host group for nodes, includes region info
[nodes]
master.example.com openshift_node_group_name='node-config-master'
node1.example.com openshift_node_group_name='node-config-compute'
node2.example.com openshift_node_group_name='node-config-compute'
infra-node1.example.com openshift_node_group_name='node-config-infra'
infra-node2.example.com openshift_node_group_name='node-config-infra'
请参阅 配置节点主机标签,以确保您了解从 OpenShift Container Platform 3.9 开始的默认节点选择器要求和节点标签注意事项。
要使用本例,修改该文件以符合您的环境和规格,并将它保存为 /etc/ansible/hosts。