Browse Source

[docker] use cri-dockerd instead of dockershim for any kubernetes version deployed with docker as the container_manager

pull/8978/head
Calin Cristian Andrei 2 years ago
committed by Kubernetes Prow Robot
parent
commit
fad296616c
9 changed files with 5 additions and 35 deletions
  1. 8
      docs/docker.md
  2. 3
      inventory/sample/group_vars/all/docker.yml
  3. 1
      roles/container-engine/cri-dockerd/molecule/default/converge.yml
  4. 8
      roles/container-engine/meta/main.yml
  5. 4
      roles/download/defaults/main.yml
  6. 7
      roles/kubernetes/node/templates/kubelet.env.v1beta1.j2
  7. 7
      roles/kubespray-defaults/defaults/main.yaml
  8. 1
      tests/files/packet_almalinux8-docker.yml
  9. 1
      tests/files/packet_ubuntu20-aio-docker.yml

8
docs/docker.md

@ -8,13 +8,7 @@ Using the docker container manager:
container_manager: docker
```
Using `cri-dockerd` instead of `dockershim`:
```yaml
cri_dockerd_enabled: false
```
*Note:* The `cri_dockerd_enabled: true` setting will become the default in a future kubespray release once kubespray 1.24+ is supported and `dockershim` is removed. At that point, changing this option will be deprecated and silently ignored.
*Note:* `cri-dockerd` has replaced `dockershim` across supported kubernetes version in kubespray 2.20.
Enabling the `overlay2` graph driver:

3
inventory/sample/group_vars/all/docker.yml

@ -57,6 +57,3 @@ docker_rpm_keepcache: 1
## A string of extra options to pass to the docker daemon.
## This string should be exactly as you wish it to appear.
# docker_options: ""
## Use CRI-DockerD instead of dockershim
# cri_dockerd_enabled: false

1
roles/container-engine/cri-dockerd/molecule/default/converge.yml

@ -4,7 +4,6 @@
become: true
vars:
container_manager: docker
cri_dockerd_enabled: true
roles:
- role: kubespray-defaults
- role: container-engine/cri-dockerd

8
roles/container-engine/meta/main.yml

@ -50,16 +50,8 @@ dependencies:
- container-engine
- containerd
- role: container-engine/docker
when:
- container_manager == 'docker'
tags:
- container-engine
- docker
- role: container-engine/cri-dockerd
when:
- cri_dockerd_enabled
- container_manager == 'docker'
tags:
- container-engine

4
roles/download/defaults/main.yml

@ -1001,7 +1001,7 @@ downloads:
crictl:
file: true
enabled: "{{ container_manager in ['crio', 'cri', 'containerd'] or cri_dockerd_enabled }}"
enabled: true
version: "{{ crictl_version }}"
dest: "{{ local_release_dir }}/crictl-{{ crictl_version }}-linux-{{ image_arch }}.tar.gz"
sha256: "{{ crictl_binary_checksum }}"
@ -1014,7 +1014,7 @@ downloads:
cri_dockerd:
file: true
enabled: "{{ cri_dockerd_enabled }}"
enabled: "{{ container_manager == 'docker' }}"
version: "{{ cri_dockerd_version }}"
dest: "{{ local_release_dir }}/cri-dockerd-{{ cri_dockerd_version }}.{{ image_arch }}.tar.gz"
sha256: "{{ cri_dockerd_archive_checksum }}"

7
roles/kubernetes/node/templates/kubelet.env.v1beta1.j2

@ -12,9 +12,6 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--config={{ kube_config_dir }}/kubelet-config.yaml \
--kubeconfig={{ kube_config_dir }}/kubelet.conf \
{# end kubeadm specific settings #}
{% if container_manager == 'docker' and not cri_dockerd_enabled %}
--pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
{% else %}
--container-runtime=remote \
--container-runtime-endpoint=unix://{{ cri_socket }} \
{% endif %}
@ -35,9 +32,7 @@ KUBELET_ARGS="{{ kubelet_args_base }} {% if node_taints|default([]) %}--register
{% if kubelet_flexvolumes_plugins_dir is defined %}
KUBELET_VOLUME_PLUGIN="--volume-plugin-dir={{ kubelet_flexvolumes_plugins_dir }}"
{% endif %}
{% if kube_network_plugin is defined and kube_network_plugin in ["calico", "canal", "cni", "flannel", "weave", "cilium", "kube-ovn", "kube-router", "macvlan"] %}
KUBELET_NETWORK_PLUGIN="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
{% elif kube_network_plugin is defined and kube_network_plugin == "cloud" %}
{% if kube_network_plugin is defined and kube_network_plugin == "cloud" %}
KUBELET_NETWORK_PLUGIN="--hairpin-mode=promiscuous-bridge --network-plugin=kubenet"
{% endif %}
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "gce", "external"] %}

7
roles/kubespray-defaults/defaults/main.yaml

@ -267,9 +267,6 @@ deploy_container_engine: "{{ inventory_hostname in groups['k8s_cluster'] or etcd
# Container for runtime
container_manager: containerd
# Enable CRI Docker interface
cri_dockerd_enabled: false
# Enable Kata Containers as additional container runtime
# When enabled, it requires `container_manager` different than Docker
kata_containers_enabled: false
@ -295,10 +292,8 @@ cri_socket: >-
/var/run/crio/crio.sock
{%- elif container_manager == 'containerd' -%}
/var/run/containerd/containerd.sock
{%- elif cri_dockerd_enabled -%}
{%- elif container_manager == 'docker' -%}
/var/run/cri-dockerd.sock
{%- else -%}
/var/run/dockershim.sock
{%- endif -%}
## Uncomment this if you want to force overlay/overlay2 as docker storage driver

1
tests/files/packet_almalinux8-docker.yml

@ -8,4 +8,3 @@ vm_memory: 3072Mi
container_manager: docker
etcd_deployment_type: docker
resolvconf_mode: docker_dns
cri_dockerd_enabled: true

1
tests/files/packet_ubuntu20-aio-docker.yml

@ -15,4 +15,3 @@ enable_nodelocaldns: False
container_manager: docker
etcd_deployment_type: docker
resolvconf_mode: docker_dns
cri_dockerd_enabled: true
Loading…
Cancel
Save