Mount local volume provisioner dirs for containerized kubelet (#2648)
This commit is contained in:
parent
1967963702
commit
f73717ea35
3 changed files with 34 additions and 0 deletions
|
@ -29,6 +29,10 @@
|
|||
{% if '/var/lib/kubelet' not in kubelet_flexvolumes_plugins_dir %}
|
||||
-v {{ kubelet_flexvolumes_plugins_dir }}:{{ kubelet_flexvolumes_plugins_dir }}:rw \
|
||||
{% endif -%}
|
||||
{% if local_volume_provisioner_enabled -%}
|
||||
-v {{ local_volume_provisioner_base_dir }}:{{ local_volume_provisioner_base_dir }}:rw \
|
||||
-v {{ local_volume_provisioner_mount_dir }}:{{ local_volume_provisioner_mount_dir }}:rw \
|
||||
{% endif %}
|
||||
-v {{kube_config_dir}}:{{kube_config_dir}}:ro \
|
||||
-v /etc/os-release:/etc/os-release:ro \
|
||||
{{ hyperkube_image_repo }}:{{ hyperkube_image_tag}} \
|
||||
|
|
|
@ -43,6 +43,14 @@ ExecStart=/usr/bin/rkt run \
|
|||
{% if '/var/lib/kubelet' not in kubelet_flexvolumes_plugins_dir %}
|
||||
--volume flexvolumes,kind=host,source={{ kubelet_flexvolumes_plugins_dir }},readOnly=false \
|
||||
{% endif %}
|
||||
{% if local_volume_provisioner_enabled %}
|
||||
--volume local_volume_provisioner_base_dir,kind=host,source={{ local_volume_provisioner_base_dir }},readOnly=false \
|
||||
{# Not pretty, but needed to avoid double mount #}
|
||||
{% if local_volume_provisioner_base_dir not in local_volume_provisioner_mount_dir and local_volume_provisioner_mount_dir not in local_volume_provisioner_base_dir %}
|
||||
--volume local_volume_provisioner_mount_dir,kind=host,source={{ local_volume_provisioner_mount_dir }},readOnly=false \
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if kubelet_load_modules == true %}
|
||||
--mount volume=modprobe,target=/usr/sbin/modprobe \
|
||||
--mount volume=lib-modules,target=/lib/modules \
|
||||
|
@ -69,6 +77,14 @@ ExecStart=/usr/bin/rkt run \
|
|||
{% if '/var/lib/kubelet' not in kubelet_flexvolumes_plugins_dir %}
|
||||
--mount volume=flexvolumes,target={{ kubelet_flexvolumes_plugins_dir }} \
|
||||
{% endif %}
|
||||
{% if local_volume_provisioner_enabled %}
|
||||
--mount local_volume_provisioner_base_dir,target={{ local_volume_provisioner_base_dir }} \
|
||||
{# Not pretty, but needed to avoid double mount #}
|
||||
{% if local_volume_provisioner_base_dir not in local_volume_provisioner_mount_dir and local_volume_provisioner_mount_dir not in local_volume_provisioner_base_dir %}
|
||||
--volume local_volume_provisioner_mount_dir,target={{ local_volume_provisioner_mount_dir }} \
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
--stage1-from-dir=stage1-fly.aci \
|
||||
{% if kube_hyperkube_image_repo == "docker" %}
|
||||
--insecure-options=image \
|
||||
|
|
|
@ -96,6 +96,20 @@
|
|||
- contiv
|
||||
- bootstrap-os
|
||||
|
||||
- name: Create local volume provisioner directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: kube
|
||||
with_items:
|
||||
- "{{ local_volume_provisioner_base_dir }}"
|
||||
- "{{ local_volume_provisioner_mount_dir }}"
|
||||
when:
|
||||
- inventory_hostname in groups['k8s-cluster']
|
||||
- local_volume_provisioner_enabled
|
||||
tags:
|
||||
- persistent_volumes
|
||||
|
||||
- import_tasks: resolvconf.yml
|
||||
when:
|
||||
- dns_mode != 'none'
|
||||
|
|
Loading…
Reference in a new issue