# Changing The Kubernetes Package Repository

LLMS index: [llms.txt](/llms.txt)

---

<!-- overview -->

This page explains how to enable a package repository for the desired
Kubernetes minor release upon upgrading a cluster. This is only needed 
for users of the community-owned package repositories hosted at `pkgs.k8s.io`.
Unlike the legacy package repositories, the community-owned package
repositories are structured in a way that there's a dedicated package
repository for each Kubernetes minor version.


<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>This guide only covers a part of the Kubernetes upgrade process. Please see the
<a href="/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/">upgrade guide</a> for
more information about upgrading Kubernetes clusters.</div>



<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>This step is only needed upon upgrading a cluster to another <strong>minor</strong> release.
If you're upgrading to another patch release within the same minor release (e.g.
v1.36.5 to v1.36.7), you don't
need to follow this guide. However, if you're still using the legacy package
repositories, you'll need to migrate to the new community-owned package
repositories before upgrading (see the next section for more details on how to
do this).</div>


## Before you begin

This document assumes that you're already using the community-owned
package repositories (`pkgs.k8s.io`). If that's not the case, it's strongly
recommended to migrate to the community-owned package repositories as described
in the [official announcement](/blog/2023/08/15/pkgs-k8s-io-introduction/).

<div class="alert alert-secondary callout note" role="note">
  <strong>Note:</strong> The legacy package repositories (<code>apt.kubernetes.io</code> and <code>yum.kubernetes.io</code>) have been
<a href="/blog/2023/08/31/legacy-package-repository-deprecation/">deprecated and frozen starting from September 13, 2023</a>.
<strong>Using the <a href="/blog/2023/08/15/pkgs-k8s-io-introduction/">new package repositories hosted at <code>pkgs.k8s.io</code></a>
is strongly recommended and required in order to install Kubernetes versions released after September 13, 2023.</strong>
The deprecated legacy repositories, and their contents, might be removed at any time in the future and without
a further notice period. The new package repositories provide downloads for Kubernetes versions starting with v1.24.0.
</div>


### Verifying if the Kubernetes package repositories are used

If you're unsure whether you're using the community-owned package repositories or the
legacy package repositories, take the following steps to verify:

<ul class="nav nav-tabs" id="tabs-k8s-install-versions" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-k8s-install-versions-0" role="tab" aria-controls="tabs-k8s-install-versions-0" aria-selected="true">Ubuntu, Debian or HypriotOS</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-k8s-install-versions-1" role="tab" aria-controls="tabs-k8s-install-versions-1">CentOS, RHEL or Fedora</a></li>
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-k8s-install-versions-2" role="tab" aria-controls="tabs-k8s-install-versions-2">openSUSE or SLES</a></li></ul>

<div class="tab-content" id="tabs-k8s-install-versions-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-k8s-install-versions-0" role="tabpanel" aria-labelledby="tabs-k8s-install-versions-0-tab" tabindex="k8s-install-versions"><p>Print the contents of the file that defines the Kubernetes <code>apt</code> repository:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># On your system, this configuration file could have a different name</span>
</span></span><span class="line"><span class="cl">pager /etc/apt/sources.list.d/kubernetes.list
</span></span></code></pre></div><p>If you see a line similar to:</p>
<pre tabindex="0"><code>deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.35/deb/ /
</code></pre><p><strong>You're using the Kubernetes package repositories and this guide applies to you.</strong>
Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories
as described in the <a href="/blog/2023/08/15/pkgs-k8s-io-introduction/">official announcement</a>.</p>
</div><div class="tab-body tab-pane fade"
        id="tabs-k8s-install-versions-1" role="tabpanel" aria-labelledby="tabs-k8s-install-versions-1-tab" tabindex="k8s-install-versions"><p>Print the contents of the file that defines the Kubernetes <code>yum</code> repository:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># On your system, this configuration file could have a different name</span>
</span></span><span class="line"><span class="cl">cat /etc/yum.repos.d/kubernetes.repo
</span></span></code></pre></div><p>If you see a <code>baseurl</code> similar to the <code>baseurl</code> in the output below:</p>
<pre tabindex="0"><code>[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl
</code></pre><p><strong>You're using the Kubernetes package repositories and this guide applies to you.</strong>
Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories
as described in the <a href="/blog/2023/08/15/pkgs-k8s-io-introduction/">official announcement</a>.</p>
</div><div class="tab-body tab-pane fade"
        id="tabs-k8s-install-versions-2" role="tabpanel" aria-labelledby="tabs-k8s-install-versions-2-tab" tabindex="k8s-install-versions"><p>Print the contents of the file that defines the Kubernetes <code>zypper</code> repository:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="c1"># On your system, this configuration file could have a different name</span>
</span></span><span class="line"><span class="cl">cat /etc/zypp/repos.d/kubernetes.repo
</span></span></code></pre></div><p>If you see a <code>baseurl</code> similar to the <code>baseurl</code> in the output below:</p>
<pre tabindex="0"><code>[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl
</code></pre><p><strong>You're using the Kubernetes package repositories and this guide applies to you.</strong>
Otherwise, it's strongly recommended to migrate to the Kubernetes package repositories
as described in the <a href="/blog/2023/08/15/pkgs-k8s-io-introduction/">official announcement</a>.</p>
</div></div>



<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4><p>The URL used for the Kubernetes package repositories is not limited to <code>pkgs.k8s.io</code>,
it can also be one of:</p>
<ul>
<li><code>pkgs.k8s.io</code></li>
<li><code>pkgs.kubernetes.io</code></li>
<li><code>packages.kubernetes.io</code></li>
</ul></div>


<!-- steps -->

## Switching to another Kubernetes package repository

This step should be done upon upgrading from one to another Kubernetes minor
release in order to get access to the packages of the desired Kubernetes minor
version.

<ul class="nav nav-tabs" id="tabs-k8s-upgrade-versions" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-k8s-upgrade-versions-0" role="tab" aria-controls="tabs-k8s-upgrade-versions-0" aria-selected="true">Ubuntu, Debian or HypriotOS</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-k8s-upgrade-versions-1" role="tab" aria-controls="tabs-k8s-upgrade-versions-1">CentOS, RHEL or Fedora</a></li></ul>

<div class="tab-content" id="tabs-k8s-upgrade-versions-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-k8s-upgrade-versions-0" role="tabpanel" aria-labelledby="tabs-k8s-upgrade-versions-0-tab" tabindex="k8s-upgrade-versions"><ol>
<li>
<p>Open the file that defines the Kubernetes <code>apt</code> repository using a text editor of your choice:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">nano /etc/apt/sources.list.d/kubernetes.list
</span></span></code></pre></div><p>You should see a single line with the URL that contains your current Kubernetes
minor version. For example, if you're using v1.35,
you should see this:</p>
<pre tabindex="0"><code>deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.35/deb/ /
</code></pre></li>
<li>
<p>Change the version in the URL to <strong>the next available minor release</strong>, for example:</p>
<pre tabindex="0"><code>deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /
</code></pre></li>
<li>
<p>Save the file and exit your text editor. Continue following the relevant upgrade instructions.</p>
</li>
</ol>
</div><div class="tab-body tab-pane fade"
        id="tabs-k8s-upgrade-versions-1" role="tabpanel" aria-labelledby="tabs-k8s-upgrade-versions-1-tab" tabindex="k8s-upgrade-versions"><ol>
<li>
<p>Open the file that defines the Kubernetes <code>yum</code> repository using a text editor of your choice:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">nano /etc/yum.repos.d/kubernetes.repo
</span></span></code></pre></div><p>You should see a file with two URLs that contain your current Kubernetes
minor version. For example, if you're using v1.35,
you should see this:</p>
<pre tabindex="0"><code>[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.35/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
</code></pre></li>
<li>
<p>Change the version in these URLs to <strong>the next available minor release</strong>, for example:</p>
<pre tabindex="0"><code>[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
</code></pre></li>
<li>
<p>Save the file and exit your text editor. Continue following the relevant upgrade instructions.</p>
</li>
</ol>
</div></div>


## What's next

* See how to [Upgrade Linux nodes](/docs/tasks/administer-cluster/kubeadm/upgrading-linux-nodes/).
* See how to [Upgrade Windows nodes](/docs/tasks/administer-cluster/kubeadm/upgrading-windows-nodes/).
