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.
|
||||
|
||||
kubernetes_allow_swap: False
|
||||
kubernetes_kubelet_extra_args: ""
|
||||
|
||||
TODO.
|
||||
TODO. Example: `"--fail-swap-on=false --cgroup-driver=systemd"`.
|
||||
|
||||
kubernetes_allow_pods_on_master: True
|
||||
|
||||
|
@ -9,7 +9,7 @@ kubernetes_packages:
|
||||
- name: kubernetes-cni
|
||||
state: present
|
||||
|
||||
kubernetes_allow_swap: False
|
||||
kubernetes_kubelet_extra_args: ""
|
||||
|
||||
kubernetes_allow_pods_on_master: True
|
||||
kubernetes_enable_web_ui: True
|
||||
|
@ -15,14 +15,14 @@
|
||||
notify: restart kubelet
|
||||
with_items: "{{ kubernetes_packages }}"
|
||||
|
||||
- name: Allow kubelet to run with swap enabled (if configured).
|
||||
- name: Configure KUBELET_EXTRA_ARGS.
|
||||
lineinfile:
|
||||
path: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
|
||||
line: 'Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"'
|
||||
regexp: 'Environment="KUBELET_EXTRA_ARGS=--fail-swap-on.+'
|
||||
line: 'Environment="KUBELET_EXTRA_ARGS={{ kubernetes_kubelet_extra_args }}"'
|
||||
regexp: 'Environment="KUBELET_EXTRA_ARGS='
|
||||
insertafter: '^Environment='
|
||||
state: present
|
||||
when: kubernetes_allow_swap
|
||||
notify: restart kubelet
|
||||
|
||||
- name: Ensure kubelet is started and enabled at boot.
|
||||
service:
|
||||
@ -66,10 +66,8 @@
|
||||
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/k8s-manifests/kube-flannel-rbac.yml
|
||||
register: flannel_networking_result
|
||||
changed_when: >
|
||||
('unchanged' not in flannel_networking_result.stdout)
|
||||
or ('configured' not in flannel_networking_result.stdout)
|
||||
register: flannel_result
|
||||
changed_when: "'created' in flannel_result.stdout"
|
||||
|
||||
# TODO: Check if taint exists with something like `kubectl describe nodes`
|
||||
# instead of using kubernetes_init_stat.stat.exists check.
|
||||
|
@ -23,4 +23,5 @@
|
||||
- name: Make cache if Kubernetes GPG key changed.
|
||||
command: "yum -q makecache -y --disablerepo='*' --enablerepo='kubernetes'"
|
||||
when: kubernetes_rpm_key is changed
|
||||
args:
|
||||
warn: no
|
||||
|
@ -2,7 +2,8 @@
|
||||
- hosts: all
|
||||
|
||||
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:
|
||||
- name: Update apt cache.
|
||||
@ -14,6 +15,11 @@
|
||||
|
||||
- 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:
|
||||
- geerlingguy.docker
|
||||
- role_under_test
|
||||
|
Loading…
Reference in New Issue
Block a user