(1)下載kube-dns命令
# wget https://dl.k8s.io/v1.5.2/kubernetes-server-linux-amd64.tar.gz
# tar -xf kubernetes-server-linux-amd64.tar.gz
# mv /opt/docker/src/kubernetes/server/bin/kube-dns /usr/bin/
(2)新建kube-dns配置文件
# vi /etc/kubernetes/kube-dns
KUBE_DNS_PORT="--dns-port=53"
KUBE_DNS_DOMAIN="--domain=cluster.local"
KUBE_DNS_MASTER=--kube-master-url="http://192.168.40.50:8080"
KUBE_DNS_ARGS=""
(3 ) 新建kube-dns.service配置文件
vi /usr/lib/systemd/system/kube-dns.service
[Unit]
Description=Kubernetes Kube-dns Server
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=kube-apiserver.service
Requires=kube-apiserver.service
[Service]
WorkingDirectory=/var/lib/kube-dns
EnvironmentFile=-/etc/kubernetes/kube-dns
ExecStart=/usr/bin/kube-dns \
$KUBE_DNS_PORT \
$KUBE_DNS_DOMAIN \
$KUBE_DNS_MASTER \
$KUBE_DNS_ARGS
Restart=on-failure
[Install]
WantedBy=multi-user.target
(4)master啟動(dòng)
# mkdir -p /var/lib/kube-dns
# systemctl enable kube-dns
# systemctl restart kube-dns
(5)master修改/etc/resolv.conf文件
search default.svc.cluster.local svc.cluster.local cluster.local
nameserver 192.168.40.50
nameserver 223.5.5.5
nameserver 202.96.128.86
(6)node結(jié)點(diǎn)修改kubelet文件
vi /etc/kubernetes/kubelet
# Add your own!
KUBELET_ARGS="--cluster-dns=192.168.40.50 --cluster-domain= cluster.local "
(7)檢測(cè)
參考:http://www.pangxie.space/docker/1055
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者