DNS 服务配置

本部分包括 DNS 服务配置.

配置 Master DNS 服务

echo "10.66.192.101     master.example.com" >> /etc/hosts
echo "10.66.192.79     registry.example.com" >> /etc/hosts
echo "10.66.192.79     git.example.com" >> /etc/hosts
echo "10.66.192.79     yum.example.com" >> /etc/hosts
echo "10.66.192.79     nfs.example.com" >> /etc/hosts
echo "10.66.192.102     node1.example.com" >> /etc/hosts
echo "10.66.192.103     node2.example.com" >> /etc/hosts
添加 dnsmasq 配置,添加 wildcard 域名指向
cat > /etc/dnsmasq.d/openshift-cluster.conf <<EOF
local=/example.com/
address=/.apps.example.com/10.66.192.102
EOF
Note
10.66.192.102 是 router 所在的 node 节点,这里是 Node1。
* 启动 dnsmasq 服务*
# systemctl start dnsmasq
# systemctl enable dnsmasq
修改 iptables 规则
cp /etc/sysconfig/iptables /etc/sysconfig/iptables.bak.$(date "+%Y%m%d%H%M%S")
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p tcp -m state --state NEW -m tcp --dport 53 -j ACCEPT' /etc/sysconfig/iptables
sed -i '/.*--dport 22 -j ACCEPT.*/a\-A INPUT -p udp -m state --state NEW -m udp --dport 53 -j ACCEPT' /etc/sysconfig/iptables
systemctl restart iptables
systemctl enable iptables
配置 Master 域名解析
systemctl restart NetworkManager
nmcli con mod $(nmcli  con show |grep -v docker|head -2|tail -1|awk '{print $1}') ipv4.dns $(hostname -i)
systemctl restart NetworkManager

配置 Registry, Node1, Node2 域名解析

在 Registry, Node1, Node2 上一次执行 如下命令:

添加 dnsmasq 配置
cat > /etc/dnsmasq.d/openshift-cluster-node.conf <<EOF
server=10.66.192.101
EOF
* 启动 dnsmasq 服务*
# systemctl start dnsmasq
# systemctl enable dnsmasq
添加 DNS
systemctl restart NetworkManager
nmcli con mod $(nmcli  con show |grep -v docker|head -2|tail -1|awk '{print $1}') ipv4.dns $(hostname -i)
systemctl restart NetworkManager

测试

所有机器上互相 ping
ping master.example.com -c3
ping node1.example.com -c3
ping node2.example.com -c3
ping registry.example.com -c3
ping git.example.com -c3
ping yum.example.com -c3
ping apps.example.com -c3

results matching ""

    No results matching ""