diff --git a/README.md b/README.md index e327d64..e93d6b2 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ Kubernetes packages to be installed on the server. You can either provide a list Whether the particular server will serve as a Kubernetes `master` (default) or `node`. The master will have `kubeadm init` run on it to intialize the entire K8s control plane, while `node`s will have `kubeadm join` run on them to join them to the `master`. kubernetes_kubelet_extra_args: "" + kubernetes_kubelet_extra_args_config_file: /etc/default/kubelet -Extra args to pass to `kubelet` during startup. E.g. to allow `kubelet` to start up even if there is swap is enabled on your server, set this to: `"--fail-swap-on=false"`. +Extra args to pass to `kubelet` during startup. E.g. to allow `kubelet` to start up even if there is swap is enabled on your server, set this to: `"--fail-swap-on=false"`. Or to specify the node-ip advertised by `kubelet`, set this to `"--node-ip={{ ansible_host }}"`. kubernetes_allow_pods_on_master: True diff --git a/defaults/main.yml b/defaults/main.yml index 7804c12..20426b8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,7 @@ kubernetes_packages: kubernetes_role: master +kubernetes_kubelet_extra_args_config_file: /etc/default/kubelet kubernetes_kubelet_extra_args: "" kubernetes_allow_pods_on_master: True diff --git a/tasks/main.yml b/tasks/main.yml index c3fe22f..8025acd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,10 +17,9 @@ - name: Configure KUBELET_EXTRA_ARGS. lineinfile: - path: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf - line: 'Environment="KUBELET_EXTRA_ARGS={{ kubernetes_kubelet_extra_args }}"' - regexp: 'Environment="KUBELET_EXTRA_ARGS=' - insertafter: '^Environment=' + path: '{{ kubernetes_kubelet_extra_args_config_file }}' + line: 'KUBELET_EXTRA_ARGS={{ kubernetes_kubelet_extra_args }}' + regexp: 'KUBELET_EXTRA_ARGS=' state: present register: kubelet_unit_file