container_manager variable to specify runtime.

This commit is contained in:
Takashi Okamoto 2018-08-28 06:23:38 +00:00
parent 5eb805f098
commit d407a590a6
11 changed files with 20 additions and 29 deletions

View file

@ -33,8 +33,8 @@
roles: roles:
- { role: kubespray-defaults} - { role: kubespray-defaults}
- { role: kubernetes/preinstall, tags: preinstall } - { role: kubernetes/preinstall, tags: preinstall }
- { role: docker, tags: docker, when: manage_docker|default(true) } - { role: docker, tags: docker, when: container_manager == 'docker' }
- { role: cri-o, tags: crio, when: manage_crio } - { role: cri-o, tags: crio, when: container_manager == 'crio' }
- role: rkt - role: rkt
tags: rkt tags: rkt
when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]" when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"

View file

@ -26,7 +26,6 @@ skip_downloads: false
``` ```
etcd_deployment_type: host etcd_deployment_type: host
kubelet_deployment_type: host kubelet_deployment_type: host
manage_docker: false container_manager: crio
manage_crio: true
``` ```

View file

@ -135,13 +135,9 @@ skydns_server_secondary: "{{ kube_service_addresses|ipaddr('net')|ipaddr(4)|ipad
dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}" dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
dns_domain: "{{ cluster_name }}" dns_domain: "{{ cluster_name }}"
# Use docker as container runtime # Container runtime
# If you set manage_crio true, set manage_docker false. # docker for docker and crio for cri-o.
manage_docker: true container_manager: docker
# Use cri-o as container runtime
# If you set manage_docker true, set manage_crio false.
manage_crio: false
# Path used to store Docker data # Path used to store Docker data
docker_daemon_graph: "/var/lib/docker" docker_daemon_graph: "/var/lib/docker"

View file

@ -15,6 +15,6 @@ discoveryTokenAPIServers:
discoveryTokenUnsafeSkipCAVerification: true discoveryTokenUnsafeSkipCAVerification: true
nodeRegistration: nodeRegistration:
name: {{ inventory_hostname }} name: {{ inventory_hostname }}
{% if manage_crio %} {% if container_manager == 'crio' %}
criSocket: /var/run/crio/crio.sock criSocket: /var/run/crio/crio.sock
{% endif %} {% endif %}

View file

@ -138,6 +138,6 @@ nodeRegistration:
taints: taints:
- effect: NoSchedule - effect: NoSchedule
key: node-role.kubernetes.io/master key: node-role.kubernetes.io/master
{% if manage_crio %} {% if container_manager == 'crio' %}
criSocket: /var/run/crio/crio.sock criSocket: /var/run/crio/crio.sock
{% endif %} {% endif %}

View file

@ -34,10 +34,10 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--node-status-update-frequency={{ kubelet_status_update_frequency }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \
--cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \ --cgroup-driver={{ kubelet_cgroup_driver|default(kubelet_cgroup_driver_detected) }} \
--max-pods={{ kubelet_max_pods }} \ --max-pods={{ kubelet_max_pods }} \
{% if manage_docker %} {% if container_manager == 'docker' %}
--docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \
{% endif %} {% endif %}
{% if manage_crio %} {% if container_manager == 'crio' %}
--container-runtime=remote \ --container-runtime=remote \
--container-runtime-endpoint=/var/run/crio/crio.sock \ --container-runtime-endpoint=/var/run/crio/crio.sock \
{% endif %} {% endif %}

View file

@ -15,7 +15,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
--cadvisor-port={{ kube_cadvisor_port }} \ --cadvisor-port={{ kube_cadvisor_port }} \
--pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \ --pod-infra-container-image={{ pod_infra_image_repo }}:{{ pod_infra_image_tag }} \
--node-status-update-frequency={{ kubelet_status_update_frequency }} \ --node-status-update-frequency={{ kubelet_status_update_frequency }} \
{% if manage_docker %} {% if container_manager == 'docker' %}
--docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \ --docker-disable-shared-pid={{ kubelet_disable_shared_pid }} \
{% endif %} {% endif %}
--client-ca-file={{ kube_cert_dir }}/ca.pem \ --client-ca-file={{ kube_cert_dir }}/ca.pem \
@ -28,7 +28,7 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% if kube_version | version_compare('v1.7', '<') %} {% if kube_version | version_compare('v1.7', '<') %}
--enable-cri={{ kubelet_enable_cri }} \ --enable-cri={{ kubelet_enable_cri }} \
{% endif %} {% endif %}
{% if manage_crio %} {% if container_manager == 'crio' %}
--container-runtime=remote \ --container-runtime=remote \
--container-runtime-endpoint=/var/run/crio/crio.sock \ --container-runtime-endpoint=/var/run/crio/crio.sock \
{% endif %} {% endif %}

View file

@ -131,13 +131,8 @@ kube_apiserver_insecure_port: 8080
# Aggregator # Aggregator
kube_api_aggregator_routing: false kube_api_aggregator_routing: false
# Docker options # Container for runtime
# Optionally do not run docker role container_manager: docker
manage_docker: true
# cri-o options
# Optionally run cri-o role
manage_crio: false
# Path used to store Docker data # Path used to store Docker data
docker_daemon_graph: "/var/lib/docker" docker_daemon_graph: "/var/lib/docker"

View file

@ -68,7 +68,7 @@
delay: 5 delay: 5
tags: tags:
- crio - crio
when: manage_crio when: container_manager == 'crio'
- name: reset | gather mounted kubelet dirs - name: reset | gather mounted kubelet dirs
shell: mount | grep /var/lib/kubelet/ | awk '{print $3}' | tac shell: mount | grep /var/lib/kubelet/ | awk '{print $3}' | tac

View file

@ -35,8 +35,9 @@
roles: roles:
- { role: kubespray-defaults} - { role: kubespray-defaults}
- { role: kubernetes/preinstall, tags: preinstall } - { role: kubernetes/preinstall, tags: preinstall }
- { role: docker, tags: docker, when: manage_docker|default(true) }
- { role: cri-o, tags: crio, when: manage_crio } - { role: docker, tags: docker, when: container_manager == 'docker' }
- { role: cri-o, tags: crio, when: container_manager == 'crio' }
- role: rkt - role: rkt
tags: rkt tags: rkt
when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]" when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"

View file

@ -34,8 +34,8 @@
roles: roles:
- { role: kubespray-defaults} - { role: kubespray-defaults}
- { role: kubernetes/preinstall, tags: preinstall } - { role: kubernetes/preinstall, tags: preinstall }
- { role: docker, tags: docker, when: manage_docker|default(true) } - { role: docker, tags: docker, when: container_manager == 'docker' }
- { role: cri-o, tags: crio, when: manage_crio } - { role: cri-o, tags: crio, when: container_manager == 'crio' }
- role: rkt - role: rkt
tags: rkt tags: rkt
when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]" when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"