why is Kuberenetes kubeadm init command unable to pull the images from the repository k8s.gcr.io
Asked Answered
T

5

5

I have 2 vms that run a kubernetes master and a slave node that i have setup locally. Till now everything was working fine but suddenly it started giving errors when I try to start the master with kubeadm init command.I have cpppied the error below.

shayeeb@ubuntu:~$ sudo kubeadm init
[init] using Kubernetes version: v1.11.1
[preflight] running pre-flight checks
I0718 11:04:57.038464   20370 kernel_validator.go:81] Validating kernel version
I0718 11:04:57.038896   20370 kernel_validator.go:96] Validating kernel config
[preflight/images] Pulling images required for setting up a Kubernetes cluster
[preflight/images] This might take a minute or two, depending on the speed of your internet connection
[preflight/images] You can also perform this action in beforehand using 'kubeadm config images pull'
[preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image [k8s.gcr.io/kube-apiserver-amd64:v1.11.1]: exit status 1
[ERROR ImagePull]: failed to pull image [k8s.gcr.io/kube-controller-manager-amd64:v1.11.1]: exit status 1
[ERROR ImagePull]: failed to pull image [k8s.gcr.io/kube-scheduler-amd64:v1.11.1]: exit status 1
[ERROR ImagePull]: failed to pull image [k8s.gcr.io/kube-proxy-amd64:v1.11.1]: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
Text answered 18/7, 2018 at 5:48 Comment(2)
I have the same issue, just 15minutes ago.Isaacson
tried, docker pull k8s.gcr.io/pause:3.1 and its working and for k8s.gcr.io/kube-apiserver-amd64:v1.11.1 it says authetication required, I this the prob is with some particular images.Isaacson
O
4

You can also run following command rather than writing the yaml,

kubeadm init --kubernetes-version=1.11.0 --apiserver-advertise-address=<public_ip> --apiserver-cert-extra-sans=<private_ip>

If you are using flannel network run following commad,

kubeadm init --kubernetes-version=1.11.0 --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=<public_ip> --apiserver-cert-extra-sans=<internal_ip> 
Otti answered 18/7, 2018 at 7:23 Comment(0)
I
3

The latest version(v1.11.1) is not pulling. You can try specifying the version like

kubeadm config images pull --kubernetes-version=v1.11.0

Isaacson answered 18/7, 2018 at 6:44 Comment(0)
M
2

The image seems to have been removed :

https://console.cloud.google.com/gcr/images/google-containers/GLOBAL/kube-apiserver-arm64?gcrImageListsize=50&gcrImageListquery=%255B%257B_22k_22_3A_22_22_2C_22t_22_3A10_2C_22v_22_3A_22_5C_22v1.11_5C_22_22%257D%255D

As a workaround, pull the latest available images and ignore pre flight errors

kubeadm config images pull --kubernetes-version=v1.11.0
kubeadm init [args] --ignore-preflight-errors=all
Muncey answered 18/7, 2018 at 6:49 Comment(2)
I tried to switch to pull v1.11.0 images and succeeded. But after initializing it is getting stuck in pulling control plane images.Text
You can modify the yaml files in the failed output and update the image files to use the version mentioned above. Then run the init command againMuncey
C
2

I was getting similar error . Proxy was causing "kubeadm config images pull" to timeout.

Similar issue was mentioned in https://github.com/kubernetes/kubeadm/issues/324 https://github.com/kubernetes/kubeadm/issues/182#issuecomment-1137419094

And the below solution provided in the above worked for me

systemctl set-environment HTTP_PROXY=http://proxy.example.com

systemctl set-environment HTTPS_PROXY=http://proxy.example.com

systemctl restart containerd.service

Codex answered 31/8, 2022 at 5:36 Comment(2)
Hours wasted! Thanks for this. Not sure why I never thought about systemctl envs.Eldoneldora
Tried so many things, finally this worked :)Hellcat
L
1

Try this approach as it is working:

You can create config.yaml file, for example

cat config.yaml
    apiVersion: kubeadm.k8s.io/v1alpha1
    kind: MasterConfiguration
    api:
      advertiseAddress: 10.44.70.201
    networking:
      podSubnet: 192.168.0.0/16
    kubernetesVersion: 1.11.0

and run kubeadm init --config=kubeadm-config.yaml

Lingerfelt answered 18/7, 2018 at 6:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.