Skip to content

Commit

Permalink
Fix docker cri
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Oct 16, 2024
1 parent 41849df commit 7334351
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
68 changes: 32 additions & 36 deletions tasks/kubeadm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion templates/kubeadm-config-join.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion templates/kubeadm-config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

0 comments on commit 7334351

Please sign in to comment.