Score:0

Can't pull images from gcr.io using kubeadm

cn flag

I cannot pull images from gcr.io using kubeadm. I do not understand the problem, as it seems to have correct internet access to get the latest version info correctly.

This is running on a ubuntu 20.04 machine. Kubernetes has been installed with:

  curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
  echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && \
  sudo apt-get update -q && \
  sudo apt-get install -qy kubelet=1.19.15-00 kubectl=1.19.15-00 kubeadm=1.19.15-00

  sudo kubeadm init

  kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
  kubectl taint nodes --all node-role.kubernetes.io/master-

But running kubeadm as preflight image pull returns with this error

kubeadm config images pull --v=5
I1021 08:14:07.979301 1611622 initconfiguration.go:104] detected and using CRI socket: /var/run/dockershim.sock
I1021 08:14:07.979712 1611622 interface.go:400] Looking for default routes with IPv4 addresses
I1021 08:14:07.979726 1611622 interface.go:405] Default route transits interface "eth0"
I1021 08:14:07.980302 1611622 interface.go:208] Interface eth0 is up
I1021 08:14:07.980394 1611622 interface.go:256] Interface "eth0" has 3 addresses :[45.142.179.100/22 2a03:4000:4a:e35:4490:e9ff:feca:f24f/64 fe80::4490:e9ff:feca:f24f/64].
I1021 08:14:07.980421 1611622 interface.go:223] Checking addr  45.142.179.100/22.
I1021 08:14:07.980436 1611622 interface.go:230] IP found 45.142.179.100
I1021 08:14:07.980448 1611622 interface.go:262] Found valid IPv4 address 45.142.179.100 for interface "eth0".
I1021 08:14:07.980458 1611622 interface.go:411] Found active IP 45.142.179.100 
I1021 08:14:08.074551 1611622 version.go:185] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.txt
I1021 08:14:13.375386 1611622 version.go:254] remote version is much newer: v1.22.2; falling back to: stable-1.20
I1021 08:14:13.375442 1611622 version.go:185] fetching Kubernetes version from URL: https://dl.k8s.io/release/stable-1.20.txt
exit status 1
output: Error response from daemon: Get "https://k8s.gcr.io/v2/": dial tcp: lookup k8s.gcr.io: Temporary failure in name resolution
, error

Update

I'm just using a blank ubuntu machine, add a new user:

$ sudo adduser <USER>
$ sudo usermod -aG sudo <USER>
$ exit
$ ssh <USER>@<IP>
$ sudo visudo

<USER> ALL=(ALL) NOPASSWD:ALL

$ sudo passwd -l root

and run this routine. That's all I do before installing kubernetes as shown above.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

sudo touch /var/lib/dpkg/lock
sudo DEBIAN_FRONTEND=noninteractive apt-get -y update > /dev/null
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq \
  apache2-utils \
  apt-transport-https \
  build-essential \
  ca-certificates \
  cifs-utils \
  curl \
  containerd.io \
  docker-ce \
  docker-ce-cli \
  gnupg2 \
  haveged \
  libpam-pwdfile \
  nfs-common \
  nfs-kernel-server \
  python \
  software-properties-common \
  unattended-upgrades \
  vsftpd > /dev/null

cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker.service
swapoff -a
sudo exportfs -a

sudo usermod -aG docker <USER>
sudo hostnamectl set-hostname kubernetes-main
kupson avatar
cn flag
Could you try `curl -v https://dl.k8s.io/release/stable-1.20.txt` and check if it gives you 302 response?
user3142695 avatar
cn flag
@kupson Running this on the server returns a 302 response
in flag
I'd bet you are using a proxy, and your user (plus maybe root as well) have configured proxy settings that either (a) kubelet does not use (b) that `output:` is coming from an entirely separate Node. Either way, you'll have to provide more details in order for anyone to help you, because that error could be caused by any number of things
user3142695 avatar
cn flag
@mdaniel I do not use a proxy. I added my install routine to the post. I don't see the problem with the created user...
Andrew Skorkin avatar
tr flag
It seems that you mixed some different configurations. Previously you install `kubeadm=1.19.15-00,` but then in logs: `falling back to: stable-1.20` Did you use any manual for kubernetes installation? Where you deployed Ubuntu - physical server, VM, etc.?
user3142695 avatar
cn flag
@AndrewSkorkin That's how I upgrade from 1.19.15 to 1.20 (https://v1-20.docs.kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/)
Andrew Skorkin avatar
tr flag
Sorry @user3142695, but I don't understand. Are you trying to install or update Kubernetes, since "I'm just using a blank ubuntu machine"?
Wytrzymały Wiktor avatar
it flag
Hello @user3142695. Any updates?
Fariya Rahmat avatar
ve flag
@user3142695 Has your issue been resolved? If yes, can you post the procedure you've followed as a solution and accept it?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.