mirror of
https://github.com/geerlingguy/ansible-role-kubernetes.git
synced 2024-11-18 19:10:39 +01:00
Really fix idempotence for Flannel tasks, and get CentOS mostly working.
This commit is contained in:
parent
9e7c1c8aae
commit
d9f100d313
@ -22,9 +22,9 @@ Available variables are listed below, along with default values (see `defaults/m
|
|||||||
|
|
||||||
TODO.
|
TODO.
|
||||||
|
|
||||||
kubernetes_allow_swap: False
|
kubernetes_kubelet_extra_args: ""
|
||||||
|
|
||||||
TODO.
|
TODO. Example: `"--fail-swap-on=false --cgroup-driver=systemd"`.
|
||||||
|
|
||||||
kubernetes_allow_pods_on_master: True
|
kubernetes_allow_pods_on_master: True
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ kubernetes_packages:
|
|||||||
- name: kubernetes-cni
|
- name: kubernetes-cni
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
kubernetes_allow_swap: False
|
kubernetes_kubelet_extra_args: ""
|
||||||
|
|
||||||
kubernetes_allow_pods_on_master: True
|
kubernetes_allow_pods_on_master: True
|
||||||
kubernetes_enable_web_ui: True
|
kubernetes_enable_web_ui: True
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
notify: restart kubelet
|
notify: restart kubelet
|
||||||
with_items: "{{ kubernetes_packages }}"
|
with_items: "{{ kubernetes_packages }}"
|
||||||
|
|
||||||
- name: Allow kubelet to run with swap enabled (if configured).
|
- name: Configure KUBELET_EXTRA_ARGS.
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
|
path: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
|
||||||
line: 'Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"'
|
line: 'Environment="KUBELET_EXTRA_ARGS={{ kubernetes_kubelet_extra_args }}"'
|
||||||
regexp: 'Environment="KUBELET_EXTRA_ARGS=--fail-swap-on.+'
|
regexp: 'Environment="KUBELET_EXTRA_ARGS='
|
||||||
insertafter: '^Environment='
|
insertafter: '^Environment='
|
||||||
state: present
|
state: present
|
||||||
when: kubernetes_allow_swap
|
notify: restart kubelet
|
||||||
|
|
||||||
- name: Ensure kubelet is started and enabled at boot.
|
- name: Ensure kubelet is started and enabled at boot.
|
||||||
service:
|
service:
|
||||||
@ -66,10 +66,8 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
|
- kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
|
||||||
- kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
|
- kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
|
||||||
register: flannel_networking_result
|
register: flannel_result
|
||||||
changed_when: >
|
changed_when: "'created' in flannel_result.stdout"
|
||||||
('unchanged' not in flannel_networking_result.stdout)
|
|
||||||
or ('configured' not in flannel_networking_result.stdout)
|
|
||||||
|
|
||||||
# TODO: Check if taint exists with something like `kubectl describe nodes`
|
# TODO: Check if taint exists with something like `kubectl describe nodes`
|
||||||
# instead of using kubernetes_init_stat.stat.exists check.
|
# instead of using kubernetes_init_stat.stat.exists check.
|
||||||
|
@ -23,4 +23,5 @@
|
|||||||
- name: Make cache if Kubernetes GPG key changed.
|
- name: Make cache if Kubernetes GPG key changed.
|
||||||
command: "yum -q makecache -y --disablerepo='*' --enablerepo='kubernetes'"
|
command: "yum -q makecache -y --disablerepo='*' --enablerepo='kubernetes'"
|
||||||
when: kubernetes_rpm_key is changed
|
when: kubernetes_rpm_key is changed
|
||||||
warn: no
|
args:
|
||||||
|
warn: no
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
kubernetes_allow_swap: True
|
# Allow swap in test environments (hard to control in some Docker envs).
|
||||||
|
kubernetes_kubelet_extra_args: "--fail-swap-on=false"
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Update apt cache.
|
- name: Update apt cache.
|
||||||
@ -14,6 +15,11 @@
|
|||||||
|
|
||||||
- action: setup
|
- action: setup
|
||||||
|
|
||||||
|
- name: Use cgroupfs cgroup driver instead of systemd (Red Hat).
|
||||||
|
set_fact:
|
||||||
|
kubernetes_kubelet_extra_args: "--fail-swap-on=false --cgroup-driver=cgroupfs"
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- geerlingguy.docker
|
- geerlingguy.docker
|
||||||
- role_under_test
|
- role_under_test
|
||||||
|
Loading…
Reference in New Issue
Block a user