mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
Signed-off-by: joyceliu <joyceliu@yunify.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
19 lines
1.5 KiB
Bash
19 lines
1.5 KiB
Bash
# Note: This dropin only works with kubeadm and kubelet v1.11+
|
|
[Service]
|
|
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
|
|
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
|
|
# This is a file that "kubeadm init" and "kubeadm join" generate at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
|
|
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
|
|
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
|
|
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
|
|
EnvironmentFile=-/etc/default/kubelet
|
|
{{- $internalIPv4 := .internal_ipv4 | default "" }}
|
|
{{- $internalIPv6 := .internal_ipv6 | default "" }}
|
|
{{- if ne $internalIPv4 "" }}
|
|
Environment="KUBELET_EXTRA_ARGS=--node-ip={{ $internalIPv4 }} --hostname-override={{ .hostname }} {{ range $k,$v := .kubernetes.kubelet.extra_args }}--{{ $k }} {{ $v }} {{ end }}"
|
|
{{- else if ne $internalIPv6 "" }}
|
|
Environment="KUBELET_EXTRA_ARGS=--node-ip={{ $internalIPv6 }} --hostname-override={{ .hostname }} {{ range $k,$v := .kubernetes.kubelet.extra_args }}--{{ $k }} {{ $v }} {{ end }}"
|
|
{{- end }}
|
|
ExecStart=
|
|
ExecStart=/usr/local/bin/kubelet --provider-id=kk://{{ .kubernetes.cluster_name }}/{{ .node_name }} $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
|