From 2df70d6a3dbaf45dee77c7f35d339f022e103c7c Mon Sep 17 00:00:00 2001 From: ant31 <2t.antoine@gmail.com> Date: Sat, 26 Dec 2015 19:57:18 +0100 Subject: [PATCH 1/4] Docker dnsmasq --- roles/dnsmasq/tasks/main.yml | 16 -------- roles/dnsmasq/templates/dnsmasq-pod.yml | 49 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 roles/dnsmasq/templates/dnsmasq-pod.yml diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 9f4169ace..d044c0885 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -28,15 +28,6 @@ - '^127\.0\.0\.1(\s+){{ inventory_hostname }}.*' - '^::1(\s+){{ inventory_hostname }}.*' -- name: install dnsmasq and bindr9utils - apt: - name: "{{ item }}" - state: present - update_cache: yes - with_items: - - dnsmasq - - bind9utils - when: inventory_hostname in groups['kube-master'] - name: ensure dnsmasq.d directory exists file: @@ -54,13 +45,6 @@ - restart dnsmasq when: inventory_hostname in groups['kube-master'] -- name: enable dnsmasq - service: - name: dnsmasq - state: started - enabled: yes - when: inventory_hostname in groups['kube-master'] - - name: update resolv.conf with new DNS setup template: src: resolv.conf.j2 diff --git a/roles/dnsmasq/templates/dnsmasq-pod.yml b/roles/dnsmasq/templates/dnsmasq-pod.yml new file mode 100644 index 000000000..1150e14c7 --- /dev/null +++ b/roles/dnsmasq/templates/dnsmasq-pod.yml @@ -0,0 +1,49 @@ +--- +apiVersion: v1 +kind: Pod +metadata: + name: dnsmasq + namespace: kube-system +spec: + hostNetwork: true + containers: + - name: dnsmasq + image: andyshinn/dnsmasq:2.72 + command: + - dnsmasq + args: + - -k + - "-7" + - /etc/dnsmasq.d + - --local-service + securityContext: + capabilities: + add: + - NET_ADMIN + imagePullPolicy: Always + resources: + limits: + cpu: 100m + memory: 256M + ports: + - name: dns + containerPort: 53 + hostPort: 53 + protocol: UDP + - name: dns-tcp + containerPort: 53 + hostPort: 53 + protocol: TCP + volumeMounts: + - name: etcdnsmasqd + mountPath: /etc/dnsmasq.d + - name: etcdnsmasqdavailable + mountPath: /etc/dnsmasq.d-available + + volumes: + - name: etcdnsmasqd + hostPath: + path: /etc/dnsmasq.d + - name: etcdnsmasqdavailable + hostPath: + path: /etc/dnsmasq.d-available From 2bd6b83656473b8131b94201dbaee5c701228045 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 30 Dec 2015 13:11:24 +0100 Subject: [PATCH 2/4] increase etcd timeout value again --- roles/etcd/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/etcd/tasks/main.yml b/roles/etcd/tasks/main.yml index a1c77f49a..3a2902a1f 100644 --- a/roles/etcd/tasks/main.yml +++ b/roles/etcd/tasks/main.yml @@ -10,4 +10,4 @@ wait_for: port: 2379 delay: 5 - timeout: 30 + timeout: 100 From e0f460d9b5c18c8bbf640277de63b39ca60ac8a6 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 30 Dec 2015 13:21:48 +0100 Subject: [PATCH 3/4] copy template dnsmasq pod and remove handlers --- roles/dnsmasq/handlers/main.yml | 3 --- roles/dnsmasq/tasks/main.yml | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) delete mode 100644 roles/dnsmasq/handlers/main.yml diff --git a/roles/dnsmasq/handlers/main.yml b/roles/dnsmasq/handlers/main.yml deleted file mode 100644 index 48b313727..000000000 --- a/roles/dnsmasq/handlers/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: restart dnsmasq - command: systemctl restart dnsmasq diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index d044c0885..8d9922bb7 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -28,7 +28,6 @@ - '^127\.0\.0\.1(\s+){{ inventory_hostname }}.*' - '^::1(\s+){{ inventory_hostname }}.*' - - name: ensure dnsmasq.d directory exists file: path: /etc/dnsmasq.d @@ -41,10 +40,20 @@ dest: /etc/dnsmasq.d/01-kube-dns.conf mode: 755 backup: yes - notify: - - restart dnsmasq when: inventory_hostname in groups['kube-master'] +- name: create dnsmasq pod template + template: src=dnsmasq-pod.yml dest=/etc/kubernetes/manifests/dnsmasq-pod.manifest + when: inventory_hostname in groups['kube-master'] + +- name: Check for dnsmasq port + wait_for: + port: 53 + delay: 5 + timeout: 100 + when: inventory_hostname in groups['kube-master'] + + - name: update resolv.conf with new DNS setup template: src: resolv.conf.j2 From b72e22012610df85247f909d9e128bbc9ae1ef7b Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 30 Dec 2015 13:28:20 +0100 Subject: [PATCH 4/4] remove carriage return --- roles/dnsmasq/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 8d9922bb7..57bb95e97 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -53,7 +53,6 @@ timeout: 100 when: inventory_hostname in groups['kube-master'] - - name: update resolv.conf with new DNS setup template: src: resolv.conf.j2