Add /var/lib/cni to kubelet

Necessary to persist this directory for host-local IPAM used by Canal
Add pre-upgrade task to copy /var/lib/cni out of old kubelet.
pull/1153/head
Matthew Mosesohn 2017-04-03 16:50:17 +03:00
parent 80828a7c77
commit b4d06ff8dd
4 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,9 @@
{%- if inventory_hostname in groups['kube-master'] and inventory_hostname not in groups['kube-node'] -%}true{%- else -%}false{%- endif -%}
tags: facts
- include: pre_upgrade.yml
tags: kubelet
- include: install.yml
tags: kubelet

View File

@ -0,0 +1,6 @@
---
- name: "Pre-upgrade | copy /var/lib/cni from kubelet"
command: docker cp kubelet:/var/lib/cni /var/lib/cni
args:
creates: "/var/lib/cni"
failed_when: false

View File

@ -21,6 +21,7 @@
-v {{ docker_daemon_graph }}:/var/lib/docker:rw \
-v /var/log:/var/log:rw \
-v /var/lib/kubelet:/var/lib/kubelet:shared \
-v /var/lib/cni:/var/lib/cni:shared \
-v /var/run:/var/run:rw \
-v {{kube_config_dir}}:{{kube_config_dir}}:ro \
{{ hyperkube_image_repo }}:{{ hyperkube_image_tag}} \

View File

@ -34,8 +34,10 @@ ExecStart=/usr/bin/rkt run \
{% if kube_network_plugin in ["calico", "weave", "canal"] %}
--volume etc-cni,kind=host,source=/etc/cni,readOnly=true \
--volume opt-cni,kind=host,source=/opt/cni,readOnly=true \
--volume var-lib-cni,kind=host,source=/var/lib/cni,readOnly=false \
--mount volume=etc-cni,target=/etc/cni \
--mount volume=opt-cni,target=/opt/cni \
--mount volume=var-lib-cni,target=/var/lib/cni \
{% endif %}
--mount volume=dns,target=/etc/resolv.conf \
--mount volume=etc-kubernetes,target={{ kube_config_dir }} \