mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Install Kubernetes 1.11 and go back to Ubuntu Xenial until Bionic is officially supported
This commit is contained in:
parent
5acc7652a9
commit
bf83e675f2
26 changed files with 765 additions and 7 deletions
40
roles/kubernetes/tasks/cni.yml
Normal file
40
roles/kubernetes/tasks/cni.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
# flannel deployment
|
||||
- name: Checking if flannel exists
|
||||
shell: "ip link | awk '$2 ~ /^(flannel|cni)/ { print $0 }' | wc -l | awk '{ print $1 }'"
|
||||
register: cni_deployment
|
||||
changed_when: False
|
||||
check_mode: False
|
||||
|
||||
- block:
|
||||
- name: Determine physical interface to use with cni
|
||||
shell: "ip route get 169.254.42.42 | head -n1 | sed -E 's/.+ dev ([^ ]+).+/\\1/'"
|
||||
register: cni_interface
|
||||
changed_when: False
|
||||
check_mode: False
|
||||
failed_when: "cni_interface.stdout is not match('^[a-z][a-z0-9]+$')"
|
||||
|
||||
- name: Create directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
with_items:
|
||||
- /etc/kube-flannel
|
||||
- /etc/cni/net.d
|
||||
- /opt/cni/bin
|
||||
|
||||
- template:
|
||||
src: kube-flannel.yml.j2
|
||||
dest: /tmp/kube-flannel.yml
|
||||
|
||||
- name: Configure cni
|
||||
shell: "kubectl apply -f /tmp/kube-flannel.yml"
|
||||
register: cni_output
|
||||
# flannel has trouble unless we restart the kubelet service
|
||||
# we'll flush_handlers later
|
||||
notify: restart kubelet
|
||||
|
||||
- debug: var="cni_output"
|
||||
|
||||
when: "cni_deployment.stdout != '2'"
|
||||
Loading…
Add table
Add a link
Reference in a new issue