OpenShift 集群的 DNS 设置

DNS set-up for an OpenShift cluster

我正在尝试使用虚拟机设置 OpenShift 集群,如 here 所述。这些虚拟机将托管在 VirtualBox 上。在这篇文章中,在 DNS 下,它说,

All of the hosts in the cluster need to be resolveable via DNS. Additionally if using a control node to serve as the ansible installer it too should be able to resolve all hosts in your cluster.

我已经开始使用 BIND9 here 设置 DNS 服务器。我可以为集群应用 BIND9 安装说明吗? DNS 服务器是否应该设置在其中一个主节点上?一个单独的虚拟机?

对于 OpenShift 3.X 和 4.X 应该在单独的地方设置(VM、Raspberry Pi 等)并且应该为所有设置 A 和 PTR 记录集群主机、public api 端点、私有 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: ocp4base_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

这是实用程序服务器上 "load balancer" 运行 的 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