对于 OpenShift 3.X 和 4.X,它应该设置在一个单独的位置(VM、Raspberry Pi 等),并且应该为所有集群主机、公共 api 端点设置 A 和 PTR 记录,私有 api 端点和 HAProxy 入口控制器。
注意:如果您正在部署 Openshift 4.X,uncontained.io 上的文档会有点过时,因为 Red Hat 咨询会赶上他们的文档。 OpenShift 3.X 和 4.X 的安装和管理机制截然不同。
如果您要部署 OpenShift 4.1,您还需要 etcd 的 A 记录和 SRV 记录。
OpenShift 4.1 裸机 DNS 要求的文档可以在 here 找到
一个示例 dnsmasq 设置,我用于单主单工作程序 OpenShift 4.1 裸机集群,其中 cluster_name: ocp4 和 base_domain:example.com 以及用作 DNS 服务器、DHCP 服务器、负载平衡器和 PXE 服务器的实用程序服务器可能看起来像:
no-hosts
domain=example.com,10.0.10.0/24,local
auth-zone=example.com,10.0.10.0/24
host-record=ocp4-utility.example.com,10.0.10.10
host-record=ocp4-master.example.com,10.0.10.11
host-record=ocp4-worker,10.0.10.12
host-record=ocp4-bootstrap,10.0.10.13
host-record=api.ocp4.example.com,10.0.10.10
host-record=api-int.ocp4.example.com,10.0.10.10
host-record=etcd-0.ocp4.example.com,10.0.10.11
srv-host=_etcd-server-ssl._tcp.ocp4.example.com,etcd-0.ocp4.example.com,2380,0,10
address=/apps.ocp4.example.com/10.0.10.10
这是在实用程序服务器上运行的“负载平衡器”的 HAProxy 配置:
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
defaults
mode tcp
log global
option tcplog
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen stats
bind :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /haproxy_stats
stats auth admin:admin
frontend kubernetes_api
bind 0.0.0.0:6443
default_backend kubernetes_api
backend kubernetes_api
balance roundrobin
option ssl-hello-chk
server bootstrap 10.0.10.13:6443 check
server master 10.0.10.11:6443 check
frontend machine_config
bind 0.0.0.0:22623
default_backend machine_config
backend machine_config
balance roundrobin
option ssl-hello-chk
server bootstrap 10.0.10.13:22623 check
server master 10.0.10.11:22623 check
frontend router_https
bind 0.0.0.0:443
default_backend router_https
backend router_https
balance roundrobin
option ssl-hello-chk
server worker 10.0.10.12:443 check
frontend router_http
mode http
option httplog
bind 0.0.0.0:80
default_backend router_http
backend router_http
mode http
balance roundrobin
server worker 10.0.10.12:80 check