From 8e516e7a6cf8e96f53cb231404d096b871eb9d59 Mon Sep 17 00:00:00 2001 From: jwfang <54740235@qq.com> Date: Fri, 16 Jun 2017 18:54:18 +0800 Subject: [PATCH] run kubedns as system:serviceaccount:kube-system:kube-dns; but dns does NOT work --- roles/kubernetes-apps/ansible/tasks/main.yml | 1 + roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml | 1 + .../ansible/templates/kubedns-serviceaccount.yml | 5 +++++ 3 files changed, 7 insertions(+) create mode 100644 roles/kubernetes-apps/ansible/templates/kubedns-serviceaccount.yml diff --git a/roles/kubernetes-apps/ansible/tasks/main.yml b/roles/kubernetes-apps/ansible/tasks/main.yml index ed0d11f28..5225bbda3 100644 --- a/roles/kubernetes-apps/ansible/tasks/main.yml +++ b/roles/kubernetes-apps/ansible/tasks/main.yml @@ -13,6 +13,7 @@ src: "{{item.file}}" dest: "{{kube_config_dir}}/{{item.file}}" with_items: + - {name: kube-dns, file: kubedns-serviceaccount.yml, type: serviceaccount} - {name: kubedns, file: kubedns-deploy.yml, type: deployment} - {name: kubedns, file: kubedns-svc.yml, type: svc} - {name: kubedns-autoscaler, file: kubedns-autoscaler.yml, type: deployment} diff --git a/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml b/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml index a2150cc70..4c7a7eec7 100644 --- a/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml +++ b/roles/kubernetes-apps/ansible/templates/kubedns-deploy.yml @@ -114,3 +114,4 @@ spec: - containerPort: 8080 protocol: TCP dnsPolicy: Default # Don't use cluster DNS. + serviceAccountName: kube-dns diff --git a/roles/kubernetes-apps/ansible/templates/kubedns-serviceaccount.yml b/roles/kubernetes-apps/ansible/templates/kubedns-serviceaccount.yml new file mode 100644 index 000000000..8cf41ae23 --- /dev/null +++ b/roles/kubernetes-apps/ansible/templates/kubedns-serviceaccount.yml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kube-dns + namespace: {{ system_namespace }}