-2
welcome@SSPLLTIT018:~$ sudo apt update
Hit:1 https://download.docker.com/linux/ubuntu focal InRelease
Hit:2 https://packages.microsoft.com/repos/code stable InRelease                                                                             
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease                                                                                       
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease                                                                               
Hit:6 https://dl.google.com/linux/chrome/deb stable InRelease                                   
Ign:4 https://packages.cloud.google.com/apt kubernetes-xenial InRelease                 
Hit:7 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 InRelease
Err:8 https://packages.cloud.google.com/apt kubernetes-xenial Release
  404  Not Found [IP: 142.250.70.46 443]
Reading package lists... Done
E: The repository 'http://apt.kubernetes.io kubernetes-xenial Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target Packages (main/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target Translations (main/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target DEP-11-icons-small (main/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target DEP-11-icons (main/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target DEP-11-icons-hidpi (main/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:32 and /etc/apt/sources.list.d/kubernetes.list:1
welcome@SSPLLTIT018:~$ sudo nano /etc/apt/sources.list
muru
  • 197,895
  • 55
  • 485
  • 740

4 Answers4

2

A repository has to have a specific structure to work with apt. One part of this structure is a file named Release. In your case, at least this file is missing from the repository in question:

E: The repository 'http://apt.kubernetes.io kubernetes-xenial Release' does not have a Release file.

There can be a number of reasons for that. Maybe what you thought to be a repository isn't one after all, and therefore it doesn't have the internal structures a repository needs to have. Maybe the repository changed its URL, and you have apt still looking at the old address for something that isn't there anymore. Maybe the repository's maintainer has made a mistake. Or maybe the repository just doesn't exist anymore.

In your case it seems to be the reason mentioned last. If you try to go to http://apt.kubernetes.io in your browser, you'll get a 404 response, meaning that there's nothing there. It even says so directly:

Err:8 https://packages.cloud.google.com/apt kubernetes-xenial Release
  404  Not Found [IP: 142.250.70.46 443]

The repository you're trying to use doesn't seem to exist anymore. You need to look for another repository that offers the packages you need.

As a side remark, it looks like you're trying to combine packages that are meant to work with different versions of Ubuntu. Most of your repositories are designed to work with Focal (Ubuntu 20.04 Focal Fossa). But the Kubernetes repository you're trying to use is designed to work with Xenial (Ubuntu 16.04 Xenial Xerus):

Hit:1 https://download.docker.com/linux/ubuntu focal InRelease

compared with

Err:8 https://packages.cloud.google.com/apt kubernetes-xenial Release

Mixing packages meant for different versions is a very good way to get you into problems. Those packages were never meant to work with each other, they were probably never tested together, and there's a good chance that they will not work together. Please only use repositories for the version of Ubuntu that you're actually using. If you're running Xenial, use repositories that are meant for Xenial. If you're running Focal, use repositories for Focal, and so forth.

1

The legacy repositories (apt.kubernetes.io and yum.kubernetes.io) are deprecated. We don't have a way to fix this for these legacy repositories. Instead, we strongly recommend migrating to the new community-owned repositories. Please see the following announcements for more details:

pkgs.k8s.io: Introducing Kubernetes Community-Owned Package Repositories Kubernetes Legacy Package Repositories Will Be Frozen On September 13, 2023 Given that there's nothing else we can do here, I'm going to lock this issue. If you encounter any issue with the new community-owned repositories, please open a new issue.

https://kubernetes.io/blog/2023/08/31/legacy-package-repository-deprecation/ https://kubernetes.io/blog/2023/08/15/pkgs-k8s-io-introduction/

How to migrate to the Kubernetes community-owned repositories? Debian, Ubuntu, and operating systems using apt/apt-get Replace the apt repository definition so that apt points to the new repository instead of the Google-hosted repository. Make sure to replace the Kubernetes minor version in the command below with the minor version that you're currently using:

echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories, so you can disregard the version in the URL:

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg Update the apt package index:

sudo apt-get update

user235989
  • 26
  • 1
0

Both answers already posted give different parts of the puzzle and are helpful. But neither addresses another category of errors you are getting, the "is configured multiple times" errors.

The text in this error message is very explicit and helpful. It is a model for how error messages should work. Read it.

As it states, for each error message, you have duplicated a line in your sources lists. It tells you the name of both files and the line number in each file.

Remove the duplicate lines to fix these errors.

To sum up, your software sources are a giant mess, with cross-version references, non-existent sources, and multiple duplicated lines. Most of these errors seem to be caused by /etc/apt/sources.list.d/kubernetes.list

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
0

Regrettably, Linux packages for versions earlier than v1.24 are not accessible in the updated Kubernetes package repositories (pkgs.k8s.io). Nonetheless, it's possible to install the necessary Kubernetes version directly from binary files. The process isn't complicated and requires 3 simple steps:

  • Download binaries from GitHub and unzip them into /usr/bin
  • Set up a service unit for kubelet
  • Download cni plugins and unzip them into /opt/cni/bin

For guidance on this process, the following article may prove useful: https://flex-solution.com/page/blog/install-k8s-lower-than-1_24.