Score:0

Ubuntu 22.04.1 LTS jammy - adding "deb http://apt.kubernetes.io/ kubernetes-xenial main" 403 Forbidden

fr flag

I am totally stuck on installing kube packages and hoping someone here could shed some light.

I am running Ubuntu Server 22.04.1 LTS Jammy

I started with $ sudo apt update && sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

^^ this worked

I then did $sudo apt-get upgrade

Installed docker and it all went fine until I got to these packages, and for three days I can't solve it. Keep reading and I'll explain.

We are attempting to setup a Kubernetes cluster.

I need to install kubelet kubeadm kubectl But it seems I am following old docs or Kubernetes is badly maintained. I wish I knew. :)

so I added the repo

echo "deb https://apt.kubernetes.io/ kubernetes-jammy main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

First thing I see is I got certificate issues when running apt update.

I then solved that with:

curl -sS https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/cloud.google.gpg

Updated my kubernetes.list with this:

echo "deb [signed-by=/usr/share/keyrings/apt-key.gpg.gpg] https://apt.kubernetes.io/ kubernetes-jammy main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

I then got a forbidden 403 error, and then realised the folder did not exist in the source url "https://packages.cloud.google.com/apt/dists"

So I changed it to Xenial as I have seen a few guides where it has apparently worked on jammy. for example:

https://www.vladimircicovic.com/2022/08/kubernetes-setup-on-ubuntu-2204-lts-jammy-jellyfish

So removed my source and created this one:

echo "deb [signed-by=/usr/share/keyrings/apt-key.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

But I am still getting forbidden.

Err:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
  403  Forbidden [IP: 142.250.178.14 443]

Does any know of an easier way to install Kubernetes cluster?

Any help would be appreciated Chadley

Random Person avatar
us flag
Can you please format the code in your post? Refer this: https://askubuntu.com/editing-help#code
David avatar
cn flag
Xenial is 16.04 a long gone EOL version of Ubuntu.
Score:0
at flag

In my case this works

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo dd status=none of=/usr/share/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
Score:0
fr flag

So after much struggling, I tried apt update and got output like this:

Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 142.250.178.14 443]
Fetched 324 kB in 7s (44.4 kB/s)
Reading package lists... Done
W: Failed to fetch http://apt.kubernetes.io/dists/kubernetes-xenial/InRelease  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 142.250.178.14 443]
W: Some index files failed to download. They have been ignored, or old ones used instead.

And this lead me to assume that IP was blocked and that it wasn't actually a certificate error. Our firewall team added the IP to the allow list for the machine and the error has gone. The problem is solved.

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.