mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
kubeadm: Remove .ImagePullPolicy
This commit is contained in:
parent
b87105aebd
commit
ddca1be88c
@ -97,9 +97,6 @@ type MasterConfiguration struct {
|
|||||||
// CertificatesDir specifies where to store or look for all required certificates.
|
// CertificatesDir specifies where to store or look for all required certificates.
|
||||||
CertificatesDir string
|
CertificatesDir string
|
||||||
|
|
||||||
// ImagePullPolicy for control plane images. Can be Always, IfNotPresent or Never.
|
|
||||||
ImagePullPolicy v1.PullPolicy
|
|
||||||
|
|
||||||
// ImageRepository is the container registry to pull control plane images from.
|
// ImageRepository is the container registry to pull control plane images from.
|
||||||
ImageRepository string
|
ImageRepository string
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ func Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas
|
|||||||
|
|
||||||
UpgradeCloudProvider(in, out)
|
UpgradeCloudProvider(in, out)
|
||||||
// We don't support migrating information from the .PrivilegedPods field which was removed in v1alpha2
|
// We don't support migrating information from the .PrivilegedPods field which was removed in v1alpha2
|
||||||
|
// We don't support migrating information from the .ImagePullPolicy field which was removed in v1alpha2
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ func autoConvert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration(in
|
|||||||
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
||||||
out.CertificatesDir = in.CertificatesDir
|
out.CertificatesDir = in.CertificatesDir
|
||||||
out.ImageRepository = in.ImageRepository
|
out.ImageRepository = in.ImageRepository
|
||||||
out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy)
|
// WARNING: in.ImagePullPolicy requires manual conversion: does not exist in peer-type
|
||||||
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
||||||
if err := Convert_v1alpha1_AuditPolicyConfiguration_To_kubeadm_AuditPolicyConfiguration(&in.AuditPolicyConfiguration, &out.AuditPolicyConfiguration, s); err != nil {
|
if err := Convert_v1alpha1_AuditPolicyConfiguration_To_kubeadm_AuditPolicyConfiguration(&in.AuditPolicyConfiguration, &out.AuditPolicyConfiguration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -290,7 +290,6 @@ func autoConvert_kubeadm_MasterConfiguration_To_v1alpha1_MasterConfiguration(in
|
|||||||
out.SchedulerExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.SchedulerExtraVolumes))
|
out.SchedulerExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.SchedulerExtraVolumes))
|
||||||
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
||||||
out.CertificatesDir = in.CertificatesDir
|
out.CertificatesDir = in.CertificatesDir
|
||||||
out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy)
|
|
||||||
out.ImageRepository = in.ImageRepository
|
out.ImageRepository = in.ImageRepository
|
||||||
// INFO: in.CIImageRepository opted out of conversion generation
|
// INFO: in.CIImageRepository opted out of conversion generation
|
||||||
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
||||||
|
@ -98,8 +98,6 @@ type MasterConfiguration struct {
|
|||||||
|
|
||||||
// ImageRepository what container registry to pull control plane images from
|
// ImageRepository what container registry to pull control plane images from
|
||||||
ImageRepository string `json:"imageRepository"`
|
ImageRepository string `json:"imageRepository"`
|
||||||
// ImagePullPolicy that control plane images. Can be Always, IfNotPresent or Never.
|
|
||||||
ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty"`
|
|
||||||
// UnifiedControlPlaneImage specifies if a specific container image should
|
// UnifiedControlPlaneImage specifies if a specific container image should
|
||||||
// be used for all control plane components.
|
// be used for all control plane components.
|
||||||
UnifiedControlPlaneImage string `json:"unifiedControlPlaneImage"`
|
UnifiedControlPlaneImage string `json:"unifiedControlPlaneImage"`
|
||||||
|
@ -249,7 +249,6 @@ func autoConvert_v1alpha2_MasterConfiguration_To_kubeadm_MasterConfiguration(in
|
|||||||
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
||||||
out.CertificatesDir = in.CertificatesDir
|
out.CertificatesDir = in.CertificatesDir
|
||||||
out.ImageRepository = in.ImageRepository
|
out.ImageRepository = in.ImageRepository
|
||||||
out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy)
|
|
||||||
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
||||||
if err := Convert_v1alpha2_AuditPolicyConfiguration_To_kubeadm_AuditPolicyConfiguration(&in.AuditPolicyConfiguration, &out.AuditPolicyConfiguration, s); err != nil {
|
if err := Convert_v1alpha2_AuditPolicyConfiguration_To_kubeadm_AuditPolicyConfiguration(&in.AuditPolicyConfiguration, &out.AuditPolicyConfiguration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -297,7 +296,6 @@ func autoConvert_kubeadm_MasterConfiguration_To_v1alpha2_MasterConfiguration(in
|
|||||||
out.SchedulerExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.SchedulerExtraVolumes))
|
out.SchedulerExtraVolumes = *(*[]HostPathMount)(unsafe.Pointer(&in.SchedulerExtraVolumes))
|
||||||
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
out.APIServerCertSANs = *(*[]string)(unsafe.Pointer(&in.APIServerCertSANs))
|
||||||
out.CertificatesDir = in.CertificatesDir
|
out.CertificatesDir = in.CertificatesDir
|
||||||
out.ImagePullPolicy = v1.PullPolicy(in.ImagePullPolicy)
|
|
||||||
out.ImageRepository = in.ImageRepository
|
out.ImageRepository = in.ImageRepository
|
||||||
// INFO: in.CIImageRepository opted out of conversion generation
|
// INFO: in.CIImageRepository opted out of conversion generation
|
||||||
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
out.UnifiedControlPlaneImage = in.UnifiedControlPlaneImage
|
||||||
|
@ -31,7 +31,6 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
@ -92,12 +91,13 @@ var (
|
|||||||
This error is likely caused by:
|
This error is likely caused by:
|
||||||
- The kubelet is not running
|
- The kubelet is not running
|
||||||
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
|
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
|
||||||
- Either there is no internet connection, or imagePullPolicy is set to "Never",
|
- No internet connection is available so the kubelet cannot pull or find the following control plane images:
|
||||||
so the kubelet cannot pull or find the following control plane images:
|
|
||||||
- {{ .APIServerImage }}
|
- {{ .APIServerImage }}
|
||||||
- {{ .ControllerManagerImage }}
|
- {{ .ControllerManagerImage }}
|
||||||
- {{ .SchedulerImage }}
|
- {{ .SchedulerImage }}
|
||||||
- {{ .EtcdImage }} (only if no external etcd endpoints are configured)
|
- {{ .EtcdImage }} (only if no external etcd endpoints are configured)
|
||||||
|
- You can check or miligate this in beforehand with "kubeadm config images pull" to make sure the images
|
||||||
|
are downloaded locally and cached.
|
||||||
|
|
||||||
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
|
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
|
||||||
- 'systemctl status kubelet'
|
- 'systemctl status kubelet'
|
||||||
@ -538,12 +538,9 @@ func getWaiter(i *Init, client clientset.Interface) apiclient.Waiter {
|
|||||||
return dryrunutil.NewWaiter()
|
return dryrunutil.NewWaiter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: List images locally using `crictl` and pull in preflight checks if not available
|
||||||
|
// When we do that, we can always assume the images exist at this point and have a shorter timeout.
|
||||||
timeout := 30 * time.Minute
|
timeout := 30 * time.Minute
|
||||||
|
|
||||||
// No need for a large timeout if we don't expect downloads
|
|
||||||
if i.cfg.ImagePullPolicy == v1.PullNever {
|
|
||||||
timeout = 60 * time.Second
|
|
||||||
}
|
|
||||||
return apiclient.NewKubeWaiter(client, timeout, os.Stdout)
|
return apiclient.NewKubeWaiter(client, timeout, os.Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.
|
|||||||
kubeadmconstants.KubeAPIServer: staticpodutil.ComponentPod(v1.Container{
|
kubeadmconstants.KubeAPIServer: staticpodutil.ComponentPod(v1.Container{
|
||||||
Name: kubeadmconstants.KubeAPIServer,
|
Name: kubeadmconstants.KubeAPIServer,
|
||||||
Image: images.GetCoreImage(kubeadmconstants.KubeAPIServer, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
Image: images.GetCoreImage(kubeadmconstants.KubeAPIServer, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
||||||
ImagePullPolicy: cfg.ImagePullPolicy,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: getAPIServerCommand(cfg),
|
Command: getAPIServerCommand(cfg),
|
||||||
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeAPIServer)),
|
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeAPIServer)),
|
||||||
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeAPIServer, int(cfg.API.BindPort), "/healthz", v1.URISchemeHTTPS),
|
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeAPIServer, int(cfg.API.BindPort), "/healthz", v1.URISchemeHTTPS),
|
||||||
@ -86,7 +86,7 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.
|
|||||||
kubeadmconstants.KubeControllerManager: staticpodutil.ComponentPod(v1.Container{
|
kubeadmconstants.KubeControllerManager: staticpodutil.ComponentPod(v1.Container{
|
||||||
Name: kubeadmconstants.KubeControllerManager,
|
Name: kubeadmconstants.KubeControllerManager,
|
||||||
Image: images.GetCoreImage(kubeadmconstants.KubeControllerManager, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
Image: images.GetCoreImage(kubeadmconstants.KubeControllerManager, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
||||||
ImagePullPolicy: cfg.ImagePullPolicy,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: getControllerManagerCommand(cfg, k8sVersion),
|
Command: getControllerManagerCommand(cfg, k8sVersion),
|
||||||
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeControllerManager)),
|
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeControllerManager)),
|
||||||
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeControllerManager, 10252, "/healthz", v1.URISchemeHTTP),
|
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeControllerManager, 10252, "/healthz", v1.URISchemeHTTP),
|
||||||
@ -96,7 +96,7 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.
|
|||||||
kubeadmconstants.KubeScheduler: staticpodutil.ComponentPod(v1.Container{
|
kubeadmconstants.KubeScheduler: staticpodutil.ComponentPod(v1.Container{
|
||||||
Name: kubeadmconstants.KubeScheduler,
|
Name: kubeadmconstants.KubeScheduler,
|
||||||
Image: images.GetCoreImage(kubeadmconstants.KubeScheduler, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
Image: images.GetCoreImage(kubeadmconstants.KubeScheduler, cfg.GetControlPlaneImageRepository(), cfg.KubernetesVersion, cfg.UnifiedControlPlaneImage),
|
||||||
ImagePullPolicy: cfg.ImagePullPolicy,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: getSchedulerCommand(cfg),
|
Command: getSchedulerCommand(cfg),
|
||||||
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeScheduler)),
|
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeScheduler)),
|
||||||
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeScheduler, 10251, "/healthz", v1.URISchemeHTTP),
|
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeScheduler, 10251, "/healthz", v1.URISchemeHTTP),
|
||||||
|
@ -61,7 +61,7 @@ func GetEtcdPodSpec(cfg *kubeadmapi.MasterConfiguration) v1.Pod {
|
|||||||
Name: kubeadmconstants.Etcd,
|
Name: kubeadmconstants.Etcd,
|
||||||
Command: getEtcdCommand(cfg),
|
Command: getEtcdCommand(cfg),
|
||||||
Image: images.GetCoreImage(kubeadmconstants.Etcd, cfg.ImageRepository, cfg.KubernetesVersion, cfg.Etcd.Image),
|
Image: images.GetCoreImage(kubeadmconstants.Etcd, cfg.ImageRepository, cfg.KubernetesVersion, cfg.Etcd.Image),
|
||||||
ImagePullPolicy: cfg.ImagePullPolicy,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
// Mount the etcd datadir path read-write so etcd can store data in a more persistent manner
|
// Mount the etcd datadir path read-write so etcd can store data in a more persistent manner
|
||||||
VolumeMounts: []v1.VolumeMount{
|
VolumeMounts: []v1.VolumeMount{
|
||||||
staticpodutil.NewVolumeMount(etcdVolumeName, cfg.Etcd.DataDir, false),
|
staticpodutil.NewVolumeMount(etcdVolumeName, cfg.Etcd.DataDir, false),
|
||||||
|
@ -29,7 +29,6 @@ Etcd:
|
|||||||
PeerCertSANs: null
|
PeerCertSANs: null
|
||||||
ServerCertSANs: null
|
ServerCertSANs: null
|
||||||
FeatureGates: null
|
FeatureGates: null
|
||||||
ImagePullPolicy: ""
|
|
||||||
ImageRepository: k8s.gcr.io
|
ImageRepository: k8s.gcr.io
|
||||||
KubeProxy:
|
KubeProxy:
|
||||||
Config:
|
Config:
|
||||||
|
Loading…
Reference in New Issue
Block a user