Skip to content

Commit

Permalink
Merge pull request #1856 from littleBlackHouse/master
Browse files Browse the repository at this point in the history
support custom argument when start the kubelet
  • Loading branch information
ks-ci-bot authored May 30, 2023
2 parents 3367bfc + bf7ba55 commit 9d69ed0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/kk/pkg/kubernetes/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func (g *GenerateKubeletEnv) Execute(runtime connector.Runtime) error {
"NodeIP": host.GetInternalAddress(),
"Hostname": host.GetName(),
"ContainerRuntime": "",
"KubeletArgs": g.KubeConf.Cluster.Kubernetes.KubeletArgs,
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/kk/pkg/kubernetes/templates/kubelet_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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
Environment="KUBELET_EXTRA_ARGS=--node-ip={{ .NodeIP }} --hostname-override={{ .Hostname }} {{ if .ContainerRuntime }}--network-plugin=cni{{ end }}"
Environment="KUBELET_EXTRA_ARGS=--node-ip={{ .NodeIP }} --hostname-override={{ .Hostname }} {{ if .ContainerRuntime }}--network-plugin=cni{{ end }} {{range .KubeletArgs }} {{.}}{{ end }}"
ExecStart=
ExecStart=/usr/local/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
`)))
4 changes: 4 additions & 0 deletions docs/config-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ spec:
#skipConfigureOS: true # Do not pre-configure the host OS (e.g. kernel modules, /etc/hosts, sysctl.conf, NTP servers, etc). You will have to set these things up via other methods before using KubeKey.

kubernetes:
#kubelet start arguments
#kubeletArgs:
# Directory path for managing kubelet files (volume mounts, etc).
# - --root-dir=/var/lib/kubelet
version: v1.21.5
# Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names.
apiserverCertExtraSans:
Expand Down

0 comments on commit 9d69ed0

Please sign in to comment.