kubeadm: pass pod-infra-container-image for all CRs

Pass the flag --pod-infra-container-image to the kubelet not only
for Docker but for all CRs.

This flag tells the kubelet to special case the image and not garbage
collect it.
This commit is contained in:
Lubomir I. Ivanov 2021-02-26 02:47:00 +02:00
parent 49e0c4456d
commit 108d1dc56a

View File

@ -79,14 +79,17 @@ func buildKubeletArgMapCommon(opts kubeletFlagsOpts) map[string]string {
if opts.nodeRegOpts.CRISocket == constants.DefaultDockerCRISocket {
// These flags should only be set when running docker
kubeletFlags["network-plugin"] = "cni"
if opts.pauseImage != "" {
kubeletFlags["pod-infra-container-image"] = opts.pauseImage
}
} else {
kubeletFlags["container-runtime"] = "remote"
kubeletFlags["container-runtime-endpoint"] = opts.nodeRegOpts.CRISocket
}
// This flag passes the pod infra container image (e.g. "pause" image) to the kubelet
// and prevents its garbage collection
if opts.pauseImage != "" {
kubeletFlags["pod-infra-container-image"] = opts.pauseImage
}
if opts.registerTaintsUsingFlags && opts.nodeRegOpts.Taints != nil && len(opts.nodeRegOpts.Taints) > 0 {
taintStrs := []string{}
for _, taint := range opts.nodeRegOpts.Taints {