Merge pull request #38 from ansibl8s/dockerize_dnsmasq
[WIP] Docker dnsmasq
This commit is contained in:
commit
005ddedb94
4 changed files with 59 additions and 21 deletions
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
- name: restart dnsmasq
|
|
||||||
command: systemctl restart dnsmasq
|
|
|
@ -28,16 +28,6 @@
|
||||||
- '^127\.0\.0\.1(\s+){{ inventory_hostname }}.*'
|
- '^127\.0\.0\.1(\s+){{ inventory_hostname }}.*'
|
||||||
- '^::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
|
- name: ensure dnsmasq.d directory exists
|
||||||
file:
|
file:
|
||||||
path: /etc/dnsmasq.d
|
path: /etc/dnsmasq.d
|
||||||
|
@ -50,15 +40,17 @@
|
||||||
dest: /etc/dnsmasq.d/01-kube-dns.conf
|
dest: /etc/dnsmasq.d/01-kube-dns.conf
|
||||||
mode: 755
|
mode: 755
|
||||||
backup: yes
|
backup: yes
|
||||||
notify:
|
|
||||||
- restart dnsmasq
|
|
||||||
when: inventory_hostname in groups['kube-master']
|
when: inventory_hostname in groups['kube-master']
|
||||||
|
|
||||||
- name: enable dnsmasq
|
- name: create dnsmasq pod template
|
||||||
service:
|
template: src=dnsmasq-pod.yml dest=/etc/kubernetes/manifests/dnsmasq-pod.manifest
|
||||||
name: dnsmasq
|
when: inventory_hostname in groups['kube-master']
|
||||||
state: started
|
|
||||||
enabled: yes
|
- name: Check for dnsmasq port
|
||||||
|
wait_for:
|
||||||
|
port: 53
|
||||||
|
delay: 5
|
||||||
|
timeout: 100
|
||||||
when: inventory_hostname in groups['kube-master']
|
when: inventory_hostname in groups['kube-master']
|
||||||
|
|
||||||
- name: update resolv.conf with new DNS setup
|
- name: update resolv.conf with new DNS setup
|
||||||
|
|
49
roles/dnsmasq/templates/dnsmasq-pod.yml
Normal file
49
roles/dnsmasq/templates/dnsmasq-pod.yml
Normal file
|
@ -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
|
|
@ -10,4 +10,4 @@
|
||||||
wait_for:
|
wait_for:
|
||||||
port: 2379
|
port: 2379
|
||||||
delay: 5
|
delay: 5
|
||||||
timeout: 30
|
timeout: 100
|
||||||
|
|
Loading…
Reference in a new issue