diff options
author | Petr OspalĂ˝ <p.ospaly@partner.samsung.com> | 2019-11-11 15:33:20 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-01-08 09:01:21 +0000 |
commit | 04d95d44b43222b6dcef5a3750bea8ab906aad48 (patch) | |
tree | db3fb85bfa3ba57040d4fdc6d913a0e962a13f41 /ansible/roles/rke | |
parent | afa9fed5280ce7aab326623a3d9c865f3b02f251 (diff) |
Add static and dynamic kubelet config support
Kubelet can be configured on startup now - just add new key/values in:
kubelet-static-config.yml.j2
Also kubelet static (startup) configuration can be overriden later
(dynamically) during its runtime - for more info read this:
https://kubernetes.io/docs/tasks/administer-cluster/reconfigure-kubelet/
Issue-ID: OOM-2199
Change-Id: Ia4790a4dfc04f0caed695df7bfd343253bd95bc0
Signed-off-by: Petr OspalĂ˝ <p.ospaly@partner.samsung.com>
Diffstat (limited to 'ansible/roles/rke')
-rw-r--r-- | ansible/roles/rke/defaults/main.yml | 4 | ||||
-rw-r--r-- | ansible/roles/rke/tasks/rke_node.yml | 11 | ||||
-rw-r--r-- | ansible/roles/rke/templates/cluster.yml.j2 | 7 | ||||
-rw-r--r-- | ansible/roles/rke/templates/kubelet-static-config.yml.j2 | 3 |
4 files changed, 23 insertions, 2 deletions
diff --git a/ansible/roles/rke/defaults/main.yml b/ansible/roles/rke/defaults/main.yml index 71c0c622..1077ee80 100644 --- a/ansible/roles/rke/defaults/main.yml +++ b/ansible/roles/rke/defaults/main.yml @@ -3,6 +3,10 @@ rke_binary: rke_linux-amd64 rke_username: rke rke_bin_dir: /usr/local/bin kube_config_dir: "{{ ansible_env.HOME }}/.kube" +kubernetes_config_dir: "/etc/kubernetes" +kubelet: + static_config: "kubelet-static-config.yml" + runtime_request_timeout: "2m0s" cluster_config_dir: "{{ app_data_path }}/cluster" # Whether dashboard is exposed. rke_dashboard_exposed: true diff --git a/ansible/roles/rke/tasks/rke_node.yml b/ansible/roles/rke/tasks/rke_node.yml index 9ec9f073..2f59b18a 100644 --- a/ansible/roles/rke/tasks/rke_node.yml +++ b/ansible/roles/rke/tasks/rke_node.yml @@ -9,3 +9,14 @@ authorized_key: user: "{{ rke_username }}" key: "{{ hostvars[groups['infrastructure'][0]].cluster_public_key }}" + +- name: "Ensure that '{{ kubernetes_config_dir }}' is present" + file: + path: "{{ kubernetes_config_dir }}" + state: directory + mode: 0755 + +- name: Prepare kubelet static config + template: + src: "kubelet-static-config.yml.j2" + dest: "{{ kubernetes_config_dir }}/{{ kubelet.static_config }}" diff --git a/ansible/roles/rke/templates/cluster.yml.j2 b/ansible/roles/rke/templates/cluster.yml.j2 index 656c1136..53e9a09a 100644 --- a/ansible/roles/rke/templates/cluster.yml.j2 +++ b/ansible/roles/rke/templates/cluster.yml.j2 @@ -67,8 +67,11 @@ services: extra_env: [] kubelet: image: "" - extra_args: {} - extra_binds: [] + extra_args: + dynamic-config-dir: "/kubelet-dynamic-config-dir" + config: "/kubelet-static-config.yml" + extra_binds: + - "{{ kubernetes_config_dir }}/{{ kubelet.static_config }}:/kubelet-static-config.yml:ro" extra_env: [] cluster_domain: cluster.local infra_container_image: "" diff --git a/ansible/roles/rke/templates/kubelet-static-config.yml.j2 b/ansible/roles/rke/templates/kubelet-static-config.yml.j2 new file mode 100644 index 00000000..71c2854d --- /dev/null +++ b/ansible/roles/rke/templates/kubelet-static-config.yml.j2 @@ -0,0 +1,3 @@ +apiVersion: kubelet.config.k8s.io/v1beta1 +kind: KubeletConfiguration +runtimeRequestTimeout: "{{ kubelet.runtime_request_timeout }}" |