diff --git a/tasks/kubeadm.yaml b/tasks/kubeadm.yaml index 2281c947..bc762c9f 100644 --- a/tasks/kubeadm.yaml +++ b/tasks/kubeadm.yaml @@ -9,42 +9,38 @@ - debug: msg="Kubeadm version installed = {{ kubeadm_output.stdout }}" -- block: - - - name: Create /etc/modules-load.d/containerd.conf - register: containerd_json - copy: - content: | - overlay - br_netfilter - dest: /etc/modules-load.d/containerd.conf - - - name: Make modprobes - command: modprobe {{item}} - with_items: - - overlay - - br_netfilter - when: containerd_json is changed - - - name: Create /etc/sysctl.d/99-kubernetes-cri.conf - register: containerd_sysctl - copy: - content: | - net.bridge.bridge-nf-call-iptables = 1 - net.ipv4.ip_forward = 1 - net.bridge.bridge-nf-call-ip6tables = 1 - dest: /etc/sysctl.d/99-kubernetes-cri.conf - - #- name: Containerd CNI for Cilium network - # template: src=10-containerd-net.conflist.j2 dest=/etc/cni/net.d/10-containerd-net.conflist - # notify: sysctl-system - # when: kube_network == 'cilium'' - - - name: Apply sysctl params - command: sysctl --system - when: containerd_sysctl is changed - - when: kube_cri_runtime in ["containerd", "crio"] +- name: Create /etc/modules-load.d/containerd.conf + register: containerd_json + copy: + content: | + overlay + br_netfilter + dest: /etc/modules-load.d/containerd.conf + +- name: Make modprobes + command: modprobe {{item}} + with_items: + - overlay + - br_netfilter + when: containerd_json is changed + +- name: Create /etc/sysctl.d/99-kubernetes-cri.conf + register: containerd_sysctl + copy: + content: | + net.bridge.bridge-nf-call-iptables = 1 + net.ipv4.ip_forward = 1 + net.bridge.bridge-nf-call-ip6tables = 1 + dest: /etc/sysctl.d/99-kubernetes-cri.conf + +#- name: Containerd CNI for Cilium network +# template: src=10-containerd-net.conflist.j2 dest=/etc/cni/net.d/10-containerd-net.conflist +# notify: sysctl-system +# when: kube_network == 'cilium'' + +- name: Apply sysctl params + command: sysctl --system + when: containerd_sysctl is changed - name: Include "{{ansible_os_family}}" Kubernetes recipe include_tasks: "{{ansible_os_family}}.yaml" \ No newline at end of file diff --git a/templates/kubeadm-config-join.j2 b/templates/kubeadm-config-join.j2 index f0a5b295..3d5035c6 100644 --- a/templates/kubeadm-config-join.j2 +++ b/templates/kubeadm-config-join.j2 @@ -12,7 +12,7 @@ nodeRegistration: {{key}}: {{value}} {% endfor %} {% if kube_cri_runtime == "docker" %} - criSocket: "/run/cri-dockerd.sock" + criSocket: "unix:///run/cri-dockerd.sock" {% endif %} discovery: bootstrapToken: diff --git a/templates/kubeadm-config.j2 b/templates/kubeadm-config.j2 index 2091559c..3f1b3fd3 100644 --- a/templates/kubeadm-config.j2 +++ b/templates/kubeadm-config.j2 @@ -43,5 +43,5 @@ bootstrapTokens: ttl: "{{kube_token_ttl}}" # --token-ttl {% if kube_cri_runtime == "docker" %} nodeRegistration: - criSocket: "/run/cri-dockerd.sock" + criSocket: "unix:///run/cri-dockerd.sock" {% endif %} \ No newline at end of file