首页 > 解决方案 > 如何设置和解析 openshift_master_cluster_hostname?

问题描述

我正在尝试使用多个主机安装 OKD 3.11,但从未成功。我正在使用三个主节点、两个工作节点和一个 lb 节点。失败与设置和解析“openshift_master_cluster_hostname”和“openshift_master_cluster_public_hostname”有关。这是我的库存文件、DNS 设置和 /etc/hosts 文件。你能告诉我有什么问题吗?

DNS 服务器在 ubuntu 16.04 上运行。/etc/bind/db.zanity.net

;
; BIND data file for zone "zanity.net"
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.
@       IN      A       127.0.0.1
osc-console          IN A 192.168.219.51
osc-console.internal IN A 192.168.219.51
osc-lb               IN A 192.168.219.50
osc-master01         IN A 192.168.219.51
osc-master02         IN A 192.168.219.52
osc-master03         IN A 192.168.219.53
osc-node01           IN A 192.168.219.54

主节点和工作节点的 /etc/hosts 文件。

[root@osc-master01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.219.100 linux-server

192.168.219.50 osc-lb
192.168.219.51 osc-console
192.168.219.51 osc-console.internal

192.168.219.51 osc-master01
192.168.219.52 osc-master02
192.168.219.53 osc-master03
192.168.219.54 osc-node01
192.168.219.55 osc-node02

master01(安装节点)/etc/ansible/hosts 中的清单文件

[OSEv3:children]
masters
nodes
nfs
etcd
lb

[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin

openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_master_htpasswd_users={'admin': '$apr1$RbOvaj8r$LEqJqG6V/O/i7Pf...'}

openshift_master_cluster_method=native
openshift_master_cluster_hostname=osc-console.internal.zanity.net
openshift_master_cluster_public_hostname=osc-console.zanity.net

openshift_node_groups=[{'name': 'node-config-master', 'labels': ['node-role.kubernetes.io/master=true']}, {'name': 'node-config-infra', 'labels': ['node-role.kubernetes.io/infra=true']}, {'name': 'node-config-compute', 'labels': ['node-role.kubernetes.io/compute=true']}, {'name': 'node-config-compute-storage', 'labels': ['node-role.kubernetes.io/compute-storage=true']}]

openshift_disable_check=memory_availability,docker_image_availability

[masters]
osc-master01.zanity.net
osc-master02.zanity.net
osc-master03.zanity.net

[nodes]
osc-master01.zanity.net openshift_node_group_name='node-config-master'
osc-master02.zanity.net openshift_node_group_name='node-config-master'
osc-master03.zanity.net openshift_node_group_name='node-config-master'
osc-node01.zanity.net openshift_node_group_name='node-config-compute'
osc-node02.zanity.net openshift_node_group_name='node-config-compute'
osc-node02.zanity.net openshift_node_group_name='node-config-infra'

[etcd]
osc-master01.zanity.net
osc-master02.zanity.net
osc-master03.zanity.net

[nfs]
osc-master02.zanity.net

[lb]
osc-lb.zanity.net
[root@osc-master01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.219.100 linux-server

192.168.219.50 osc-lb
192.168.219.51 osc-console
192.168.219.51 osc-console.internal

192.168.219.51 osc-master01
192.168.219.52 osc-master02
192.168.219.53 osc-master03
192.168.219.54 osc-node01
192.168.219.55 osc-node02

我尝试了以下组合来解析主机名和公共主机名的地址,但都失败了。案例 1) 192.168.219.50 osc-lb 192.168.219.50 osc-console 192.168.219.50 osc-console.internal => 失败并显示“控制平面吊舱没有出现”

案例 2) 92.168.219.50 osc-lb 192.168.219.50 osc-console 192.168.219.51 osc-console.internal => 因“控制平面 pod 未出现”而失败或 => 因与客户认证相关的问题而失败。

案例 3) 92.168.219.50 osc-lb 192.168.219.51 osc-console 192.168.219.51 osc-console.internal => 失败并出现以下问题

PLAY RECAP **************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=13   changed=0    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0
osc-lb.zanity.net          : ok=9    changed=0    unreachable=0    failed=1    skipped=26   rescued=0    ignored=0
osc-master01.zanity.net    : ok=303  changed=120  unreachable=0    failed=0    skipped=237  rescued=0    ignored=0
osc-master02.zanity.net    : ok=254  changed=104  unreachable=0    failed=0    skipped=217  rescued=0    ignored=0
osc-master03.zanity.net    : ok=243  changed=103  unreachable=0    failed=1    skipped=213  rescued=0    ignored=0
osc-node01.zanity.net      : ok=100  changed=34   unreachable=0    failed=0    skipped=96   rescued=0    ignored=0
osc-node02.zanity.net      : ok=100  changed=34   unreachable=0    failed=0    skipped=96   rescued=0    ignored=0


INSTALLER STATUS ********************************************************************************************************************************************************************************************************************************************************************
Initialization              : Complete (0:00:23)
Health Check                : Complete (0:00:12)
Node Bootstrap Preparation  : Complete (0:05:43)
etcd Install                : Complete (0:00:42)
NFS Install                 : Complete (0:00:04)
Load Balancer Install       : Complete (0:00:00)
Master Install              : In Progress (0:22:19)
        This phase can be restarted by running: playbooks/openshift-master/config.yml
Tuesday 08 October 2019  16:07:08 +0900 (0:18:46.369)       0:29:22.463 *******
===============================================================================
openshift_control_plane : Wait for all control plane pods to become ready ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1126.37s
openshift_node : Install node, clients, and conntrack packages ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 224.22s
openshift_control_plane : Wait for control plane pods to appear ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 94.48s
openshift_ca : Install the base package for admin tooling ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 12.48s
Run health checks (install) - EL -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 11.84s
openshift_excluder : Install openshift excluder - yum ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10.33s
openshift_excluder : Install docker excluder - yum --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8.80s
openshift_cli : Install clients ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.68s
openshift_master_certificates : copy ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.63s
openshift_node : Update journald setup --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4.53s
tuned : Ensure files are populated from templates ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.94s
openshift_master_certificates : Check status of master certificates ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.53s
openshift_node : Add iptables allow rules ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3.17s
openshift_control_plane : Copy static master scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.12s
Gathering Facts -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.12s
openshift_control_plane : Prepare master static pods ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.07s
tuned : Restart tuned service ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2.33s
openshift_node : install needed rpm(s) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.13s
openshift_node : create directories for bootstrapping --------------------------------------------------------------------------------------------------------------------------------------------- 2.11s
openshift_control_plane : Ensure htpasswd file exists ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2.07s


Failure summary:


  1. Hosts:    osc-lb.zanity.net
     Play:     Initialize cluster facts
     Task:     Gather Cluster facts
     Message:  MODULE FAILURE
               See stdout/stderr for the exact error

  2. Hosts:    osc-master03.zanity.net
     Play:     Configure masters
     Task:     Wait for all control plane pods to become ready

标签: ansibleopenshift

解决方案


尝试将其放置osc-console.internal.zanity.net在与其他主机相同的级别以避免任何 DNS 解析问题。例如,重命名它osc-console-internal.zanity.net

此外,根据文档,openshift_master_cluster_hostname并且openshift_master_cluster_public_hostname必须由平衡服务支持。如果您使用的是安装期间部署的平衡器,请检查

  • 负载平衡服务由 ansible playbook 正确配置,并配置为在 port 上的主节点之间进行平衡:8443
  • openshift_master_cluster_hostname您的 lb 服务点的 dns 记录。
[...]
# Native high availability cluster method with optional load balancer.
# If no lb group is defined installer assumes that a load balancer has
# been preconfigured. For installation the value of
# openshift_master_cluster_hostname must resolve to the load balancer
# or to one or all of the masters defined in the inventory if no load
# balancer is present.
[...]

https://docs.openshift.com/container-platform/3.11/install/example_inventories.html#multi-masters-single-etcd-using-native-ha


推荐阅读