安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合
Posted 马肯尼煤牙巴骨
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合相关的知识,希望对你有一定的参考价值。
安装dnsmasq
yum -y install dnsmasq
配置
vim /etc/mnsmasq.conf
修改以下几个数据
# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
resolv-file=/etc/resolv.dnsmasq.conf
# By default, dnsmasq will send queries to any of the upstream
# servers it knows about and tries to favour servers to are known
# to be up. Uncommenting this forces dnsmasq to try each query
# with each server strictly in the order they appear in
# /etc/resolv.conf
strict-order
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
listen-address=监听的本地IP
添加解析
# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.
#address=/double-click.net/127.0.0.1
address=/k8s.haoyun.com.vip/10.7.1.200
address=/k8s.haoyun.com.m1/10.7.1.201
address=/k8s.haoyun.com.m2/10.7.1.202
address=/k8s.haoyun.com.m3/10.7.1.203
address=/k8s.haoyun.com.n1/10.7.1.211
address=/k8s.haoyun.com.n2/10.7.1.212
address=/k8s.haoyun.com.n3/10.7.1.213
address=/k8s.haoyun.com.n4/10.7.1.214
address=/k8s.haoyun.com.n5/10.7.1.215
address=/k8s.haoyun.com.n6/10.7.1.216
address=/k8s.haoyun.com.w1/10.7.1.221
address=/k8s.haoyun.com.w2/10.7.1.222
address=/k8s.haoyun.com.w3/10.7.1.223
address=/k8s.haoyun.com.w4/10.7.1.224
# Add other name servers here, with domain specs if they are for
# non-public domains.
#server=10.7.1.201
设置上游dns
nameserver 10.7.1.201
nameserver 8.8.8.8
在其他linux机器上设置dns服务器
# vi /etc/resolv.conf
# Generated by NetworkManager
nameserver 10.7.1.201
nameserver 10.0.3.88
:wq
测试
#nslookup www.baidu.com
Server: 10.0.3.88
Address: 10.0.3.88#53
以上是关于安装 局域网用的dns服务器,为多环境k8s的ip地址解耦合的主要内容,如果未能解决你的问题,请参考以下文章
项目环境搭建Docker+k8s二 || centos7服务器通用设置