Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ podsecuritypolicy_enabled: false
# system_master_memory_reserved: 256M
# system_master_cpu_reserved: 250m

# An alternative flexvolume plugin directory
# The flexvolumes plugins directory
# kubelet_flexvolumes_plugins_dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
# Alternative directory if the default flexvolume plugin directory is not writeable
# kubelet_flexvolumes_plugins_ro_alt_dir: /var/lib/kubelet/volumeplugins

## Supplementary addresses that can be added in kubernetes ssl keys.
## That can be useful for example to setup a keepalived virtual IP
Expand Down
3 changes: 2 additions & 1 deletion roles/kubernetes/preinstall/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ kube_config_dir: /etc/kubernetes
kube_cert_dir: "{{ kube_config_dir }}/ssl"
kube_cert_compat_dir: /etc/kubernetes/pki
kubelet_flexvolumes_plugins_dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec

# Alternative path for systems where the default kubelet_flexvolumes_plugins_dir is readonly, e.g. CoreOS
kubelet_flexvolumes_plugins_ro_alt_dir: /var/lib/kubelet/volumeplugins
# Container Linux by CoreOS cloud init config file to define /etc/resolv.conf content
# for hostnet pods and infra needs
resolveconf_cloud_init_conf: /etc/resolveconf_cloud_init.conf
Expand Down
15 changes: 10 additions & 5 deletions roles/kubernetes/preinstall/tasks/0040-set_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@
when:
- etcd_kubeadm_enabled

- name: check /usr readonly
- name: check if the flexvolume root path is readonly
stat:
path: "/usr"
register: usr
path: "{{ kubelet_flexvolumes_plugins_dir | regex_search('^/[^/]+(/|$)') }}" # matches the first directory in the path
register: flexvp_path

- name: notify about the alternative flexvolume path
debug:
msg: "The flexvolumes plugins path {{ kubelet_flexvolumes_plugins_dir }} is not writeable, using {{ kubelet_flexvolumes_plugins_ro_alt_dir }}."
when: not flexvp_path.stat.writeable

- name: set alternate flexvolume path
set_fact:
kubelet_flexvolumes_plugins_dir: /var/lib/kubelet/volumeplugins
when: not usr.stat.writeable
kubelet_flexvolumes_plugins_dir: "{{ kubelet_flexvolumes_plugins_ro_alt_dir }}"
when: not flexvp_path.stat.writeable