From 0b3c1b6dce5df4dd5e573067270a7105fe850ec6 Mon Sep 17 00:00:00 2001 From: jmgao Date: Thu, 26 Apr 2018 14:18:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0kubedns=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/kubedns.md | 14 ++++++++++++++ manifests/kubedns/kubedns.yaml | 12 ++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/guide/kubedns.md b/docs/guide/kubedns.md index 250808995..4f6d7cbe2 100644 --- a/docs/guide/kubedns.md +++ b/docs/guide/kubedns.md @@ -17,6 +17,20 @@ $ kubectl create -f /etc/ansible/manifests/coredns ``` + 集群 pod默认继承 node的dns 解析,修改 kubelet服务启动参数 --resolv-conf="",可以更改这个特性,详见 kubelet 启动参数 ++ 如果你使用`calico`网络组件,通过命令`ansible-playbook 90.setup.yml`安装完集群后,直接安装dns组件,可能会出现如下BUG,分析是因为calico分配pod地址时候会从网段的第一个地址(网络地址)开始,详见提交的 [ISSUE #1710](https://github.com/projectcalico/calico/issues/1710),临时解决办法为手动删除POD,重新创建后获取后面的IP地址 + +``` +# BUG出现现象 +$ kubectl get pod --all-namespaces -o wide +NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE +default busy-5cc98488d4-s894w 1/1 Running 0 28m 172.20.24.193 192.168.97.24 +kube-system calico-kube-controllers-6597d9c664-nq9hn 1/1 Running 0 1h 192.168.97.24 192.168.97.24 +kube-system calico-node-f8gnf 2/2 Running 0 1h 192.168.97.24 192.168.97.24 +kube-system kube-dns-69bf9d5cc9-c68mw 0/3 CrashLoopBackOff 27 31m 172.20.24.192 192.168.97.24 + +# 解决办法,删除pod,自动重建 +$ kubectl delete pod -n kube-system kube-dns-69bf9d5cc9-c68mw +``` ### 验证 dns服务 diff --git a/manifests/kubedns/kubedns.yaml b/manifests/kubedns/kubedns.yaml index 3763d31c8..63f5f26e4 100644 --- a/manifests/kubedns/kubedns.yaml +++ b/manifests/kubedns/kubedns.yaml @@ -79,8 +79,8 @@ spec: optional: true containers: - name: kubedns - #image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.8 - image: mirrorgooglecontainers/k8s-dns-kube-dns-amd64:1.14.8 + #image: gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.9 + image: mirrorgooglecontainers/k8s-dns-kube-dns-amd64:1.14.9 resources: # TODO: Set memory limits when we've profiled the container for large # clusters, then set request = limit to keep this container in @@ -131,8 +131,8 @@ spec: - name: kube-dns-config mountPath: /kube-dns-config - name: dnsmasq - #image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.8 - image: mirrorgooglecontainers/k8s-dns-dnsmasq-nanny-amd64:1.14.8 + #image: gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.9 + image: mirrorgooglecontainers/k8s-dns-dnsmasq-nanny-amd64:1.14.9 livenessProbe: httpGet: path: /healthcheck/dnsmasq @@ -170,8 +170,8 @@ spec: - name: kube-dns-config mountPath: /etc/k8s/dns/dnsmasq-nanny - name: sidecar - #image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.8 - image: mirrorgooglecontainers/k8s-dns-sidecar-amd64:1.14.8 + #image: gcr.io/google_containers/k8s-dns-sidecar-amd64:1.14.9 + image: mirrorgooglecontainers/k8s-dns-sidecar-amd64:1.14.9 livenessProbe: httpGet: path: /metrics