rongzhang 6 years ago
parent
commit
77e08ba204
6 changed files with 31 additions and 0 deletions
  1. 8
      inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml
  2. 4
      roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2
  3. 7
      roles/kubernetes/node/tasks/main.yml
  4. 3
      roles/kubernetes/node/templates/kubelet.kubeadm.env.j2
  5. 8
      roles/kubespray-defaults/defaults/main.yaml
  6. 1
      tests/files/gce_centos-weave-kubeadm.yml

8
inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml

@ -154,6 +154,14 @@ k8s_image_pull_policy: IfNotPresent
# audit log for kubernetes
kubernetes_audit: false
# dynamic kubelet configuration
dynamic_kubelet_configuration: false
# define kubelet config dir for dynamic kubelet
#kubelet_config_dir:
default_kubelet_config_dir: "{{ kube_config_dir }}/dynamic_kubelet_dir"
dynamic_kubelet_configuration_dir: "{{ kubelet_config_dir | default(default_kubelet_config_dir) }}"
# pod security policy (RBAC must be enabled either by having 'RBAC' in authorization_modes or kubeadm enabled)
podsecuritypolicy_enabled: false

4
roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2

@ -150,3 +150,7 @@ nodeRegistration:
{% if container_manager == 'crio' %}
criSocket: /var/run/crio/crio.sock
{% endif %}
{% if dynamic_kubelet_configuration %}
featureGates:
DynamicKubeletConfig: true
{% endif %}

7
roles/kubernetes/node/tasks/main.yml

@ -32,6 +32,13 @@
tags:
- kubelet
- name: Make sure dynamic kubelet configuration directory is writeable
file:
path: "{{ dynamic_kubelet_configuration_dir }}"
mode: 0600
state: directory
when: dynamic_kubelet_configuration
- name: Write kubelet config file (kubeadm)
template:
src: kubelet.kubeadm.env.j2

3
roles/kubernetes/node/templates/kubelet.kubeadm.env.j2

@ -48,6 +48,9 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{% else %}
--fail-swap-on={{ kubelet_fail_swap_on|default(true)}} \
{% endif %}
{% if dynamic_kubelet_configuration %}
--dynamic-config-dir={{ dynamic_kubelet_configuration_dir }} \
{% endif %}
--runtime-cgroups={{ kubelet_runtime_cgroups }} --kubelet-cgroups={{ kubelet_kubelet_cgroups }} \
{% endset %}

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

@ -136,6 +136,14 @@ kube_apiserver_port: 6443
kube_apiserver_insecure_bind_address: 127.0.0.1
kube_apiserver_insecure_port: 8080
# dynamic kubelet configuration
dynamic_kubelet_configuration: false
# define kubelet config dir for dynamic kubelet
#kubelet_config_dir:
default_kubelet_config_dir: "{{ kube_config_dir }}/dynamic_kubelet_dir"
dynamic_kubelet_configuration_dir: "{{ kubelet_config_dir | default(default_kubelet_config_dir) }}"
# Aggregator
kube_api_aggregator_routing: false

1
tests/files/gce_centos-weave-kubeadm.yml

@ -10,5 +10,6 @@ kube_network_plugin: weave
kubeadm_enabled: true
deploy_netchecker: true
kubernetes_audit: true
dynamic_kubelet_configuration: true
kubedns_min_replicas: 1
cloud_provider: gce
Loading…
Cancel
Save