# Install and Set Up kubectl on Linux

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

---

## Before you begin

You must use a kubectl version that is within one minor version difference of
your cluster. For example, a v1.36 client can communicate
with v1.35, v1.36,
and v1.37 control planes.
Using the latest compatible version of kubectl helps avoid unforeseen issues.

## Install kubectl on Linux

The following methods exist for installing kubectl on Linux:

- [Install kubectl binary with curl on Linux](#install-kubectl-binary-with-curl-on-linux)
- [Install using native package management](#install-using-native-package-management)
- [Install using other package management](#install-using-other-package-management)

### Install kubectl binary with curl on Linux

1. Download the latest release with the command:

   <ul class="nav nav-tabs" id="tabs-download-binary-linux" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-download-binary-linux-0" role="tab" aria-controls="tabs-download-binary-linux-0" aria-selected="true">x86-64</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-download-binary-linux-1" role="tab" aria-controls="tabs-download-binary-linux-1">ARM64</a></li></ul>

<div class="tab-content" id="tabs-download-binary-linux-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-download-binary-linux-0" role="tabpanel" aria-labelledby="tabs-download-binary-linux-0-tab" tabindex="download-binary-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/amd64/kubectl&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-download-binary-linux-1" role="tabpanel" aria-labelledby="tabs-download-binary-linux-1-tab" tabindex="download-binary-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/arm64/kubectl&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div></div>


   
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4><p>To download a specific version, replace the <code>$(curl -L -s https://dl.k8s.io/release/stable.txt)</code>
portion of the command with the specific version.</p>
<p>For example, to download version 1.36.0 on Linux x86-64, type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -LO https://dl.k8s.io/release/v1.36.0/bin/linux/amd64/kubectl
</span></span></code></pre></div><p>And for Linux ARM64, type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -LO https://dl.k8s.io/release/v1.36.0/bin/linux/arm64/kubectl
</span></span></code></pre></div></div>


1. Validate the binary (optional)

   Download the kubectl checksum file:

   <ul class="nav nav-tabs" id="tabs-download-checksum-linux" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-download-checksum-linux-0" role="tab" aria-controls="tabs-download-checksum-linux-0" aria-selected="true">x86-64</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-download-checksum-linux-1" role="tab" aria-controls="tabs-download-checksum-linux-1">ARM64</a></li></ul>

<div class="tab-content" id="tabs-download-checksum-linux-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-download-checksum-linux-0" role="tabpanel" aria-labelledby="tabs-download-checksum-linux-0-tab" tabindex="download-checksum-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/amd64/kubectl.sha256&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-download-checksum-linux-1" role="tabpanel" aria-labelledby="tabs-download-checksum-linux-1-tab" tabindex="download-checksum-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/arm64/kubectl.sha256&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div></div>


   Validate the kubectl binary against the checksum file:

   ```bash
   echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
   ```

   If valid, the output is:

   ```console
   kubectl: OK
   ```

   If the check fails, `sha256` exits with nonzero status and prints output similar to:

   ```console
   kubectl: FAILED
   sha256sum: WARNING: 1 computed checksum did NOT match
   ```

   
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>Download the same version of the binary and checksum.</div>


1. Install kubectl

   ```bash
   sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
   ```

   
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4><p>If you do not have root access on the target system, you can still install
kubectl to the <code>~/.local/bin</code> directory:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">chmod +x kubectl
</span></span><span class="line"><span class="cl">mkdir -p ~/.local/bin
</span></span><span class="line"><span class="cl">mv ./kubectl ~/.local/bin/kubectl
</span></span><span class="line"><span class="cl"><span class="c1"># and then append (or prepend) ~/.local/bin to $PATH</span>
</span></span></code></pre></div></div>


1. Test to ensure the version you installed is up-to-date:

   ```bash
   kubectl version --client
   ```

   Or use this for detailed view of version:

   ```cmd
   kubectl version --client --output=yaml
   ```

### Install using native package management

<ul class="nav nav-tabs" id="tabs-kubectl-install" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-kubectl-install-0" role="tab" aria-controls="tabs-kubectl-install-0" aria-selected="true">Debian-based distributions</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-kubectl-install-1" role="tab" aria-controls="tabs-kubectl-install-1">Red Hat-based distributions</a></li>
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-kubectl-install-2" role="tab" aria-controls="tabs-kubectl-install-2">SUSE-based distributions</a></li></ul>

<div class="tab-content" id="tabs-kubectl-install-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-kubectl-install-0" role="tabpanel" aria-labelledby="tabs-kubectl-install-0-tab" tabindex="kubectl-install"><ol>
<li>
<p>Update the <code>apt</code> package index and install packages needed to use 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">sudo apt-get update
</span></span><span class="line"><span class="cl"><span class="c1"># apt-transport-https may be a dummy package; if so, you can skip that package</span>
</span></span><span class="line"><span class="cl">sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
</span></span></code></pre></div></li>
<li>
<p>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:</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"># If the folder `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.</span>
</span></span><span class="line"><span class="cl"><span class="c1"># sudo mkdir -p -m 755 /etc/apt/keyrings</span>
</span></span><span class="line"><span class="cl">curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key <span class="p">|</span> sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
</span></span><span class="line"><span class="cl">sudo chmod <span class="m">644</span> /etc/apt/keyrings/kubernetes-apt-keyring.gpg <span class="c1"># allow unprivileged APT programs to read this keyring</span>
</span></span></code></pre></div></li>
</ol>
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>In releases older than Debian 12 and Ubuntu 22.04, folder <code>/etc/apt/keyrings</code> does not exist by default, and it should be created before the curl command.</div>
<ol start="3">
<li>
<p>Add the appropriate Kubernetes <code>apt</code> repository. If you want to use Kubernetes version different than v1.36,
replace v1.36 with the desired minor version in the command below:</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"># This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list</span>
</span></span><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s1">&#39;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /&#39;</span> <span class="p">|</span> sudo tee /etc/apt/sources.list.d/kubernetes.list
</span></span><span class="line"><span class="cl">sudo chmod <span class="m">644</span> /etc/apt/sources.list.d/kubernetes.list   <span class="c1"># helps tools such as command-not-found to work correctly</span>
</span></span></code></pre></div></li>
</ol>
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>To upgrade kubectl to another minor release, you'll need to bump the version in <code>/etc/apt/sources.list.d/kubernetes.list</code> before running <code>apt-get update</code> and <code>apt-get upgrade</code>. This procedure is described in more detail in <a href="/docs/tasks/administer-cluster/kubeadm/change-package-repository/">Changing The Kubernetes Package Repository</a>.</div>
<ol start="4">
<li>
<p>Update <code>apt</code> package index, then install kubectl:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">sudo apt-get update
</span></span><span class="line"><span class="cl">sudo apt-get install -y kubectl
</span></span></code></pre></div></li>
</ol>
</div><div class="tab-body tab-pane fade"
        id="tabs-kubectl-install-1" role="tabpanel" aria-labelledby="tabs-kubectl-install-1-tab" tabindex="kubectl-install"><ol>
<li>
<p>Add the Kubernetes <code>yum</code> repository. If you want to use Kubernetes version
different than v1.36, replace v1.36 with
the desired minor version in the command below.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo</span>
</span></span><span class="line"><span class="cl">cat <span class="s">&lt;&lt;EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
</span></span></span><span class="line"><span class="cl"><span class="s">[kubernetes]
</span></span></span><span class="line"><span class="cl"><span class="s">name=Kubernetes
</span></span></span><span class="line"><span class="cl"><span class="s">baseurl=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/
</span></span></span><span class="line"><span class="cl"><span class="s">enabled=1
</span></span></span><span class="line"><span class="cl"><span class="s">gpgcheck=1
</span></span></span><span class="line"><span class="cl"><span class="s">gpgkey=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/repodata/repomd.xml.key
</span></span></span><span class="line"><span class="cl"><span class="s">EOF</span>
</span></span></code></pre></div></li>
</ol>
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>To upgrade kubectl to another minor release, you'll need to bump the version in <code>/etc/yum.repos.d/kubernetes.repo</code> before running <code>yum update</code>. This procedure is described in more detail in <a href="/docs/tasks/administer-cluster/kubeadm/change-package-repository/">Changing The Kubernetes Package Repository</a>.</div>
<ol start="2">
<li>
<p>Install kubectl using <code>yum</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo yum install -y kubectl
</span></span></code></pre></div></li>
</ol>
</div><div class="tab-body tab-pane fade"
        id="tabs-kubectl-install-2" role="tabpanel" aria-labelledby="tabs-kubectl-install-2-tab" tabindex="kubectl-install"><ol>
<li>
<p>Add the Kubernetes <code>zypper</code> repository. If you want to use Kubernetes version
different than v1.36, replace v1.36 with
the desired minor version in the command below.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># This overwrites any existing configuration in /etc/zypp/repos.d/kubernetes.repo</span>
</span></span><span class="line"><span class="cl">cat <span class="s">&lt;&lt;EOF | sudo tee /etc/zypp/repos.d/kubernetes.repo
</span></span></span><span class="line"><span class="cl"><span class="s">[kubernetes]
</span></span></span><span class="line"><span class="cl"><span class="s">name=Kubernetes
</span></span></span><span class="line"><span class="cl"><span class="s">baseurl=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/
</span></span></span><span class="line"><span class="cl"><span class="s">enabled=1
</span></span></span><span class="line"><span class="cl"><span class="s">gpgcheck=1
</span></span></span><span class="line"><span class="cl"><span class="s">gpgkey=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/repodata/repomd.xml.key
</span></span></span><span class="line"><span class="cl"><span class="s">EOF</span>
</span></span></code></pre></div></li>
</ol>
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>To upgrade kubectl to another minor release, you'll need to bump the version in <code>/etc/zypp/repos.d/kubernetes.repo</code>
before running <code>zypper update</code>. This procedure is described in more detail in
<a href="/docs/tasks/administer-cluster/kubeadm/change-package-repository/">Changing The Kubernetes Package Repository</a>.</div>
<ol start="2">
<li>
<p>Update <code>zypper</code> and confirm the new repo addition:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo zypper update
</span></span></code></pre></div><p>When this message appears, press 't' or 'a':</p>
<pre tabindex="0"><code>New repository or package signing key received:

Repository:       Kubernetes
Key Fingerprint:  1111 2222 3333 4444 5555 6666 7777 8888 9999 AAAA
Key Name:         isv:kubernetes OBS Project &lt;isv:kubernetes@build.opensuse.org&gt;
Key Algorithm:    RSA 2048
Key Created:      Thu 25 Aug 2022 01:21:11 PM -03
Key Expires:      Sat 02 Nov 2024 01:21:11 PM -03 (expires in 85 days)
Rpm Name:         gpg-pubkey-9a296436-6307a177

Note: Signing data enables the recipient to verify that no modifications occurred after the data
were signed. Accepting data with no, wrong or unknown signature can lead to a corrupted system
and in extreme cases even to a system compromise.

Note: A GPG pubkey is clearly identified by its fingerprint. Do not rely on the key&#39;s name. If
you are not sure whether the presented key is authentic, ask the repository provider or check
their web site. Many providers maintain a web page showing the fingerprints of the GPG keys they
are using.

Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): a
</code></pre></li>
<li>
<p>Install kubectl using <code>zypper</code>:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo zypper install -y kubectl
</span></span></code></pre></div></li>
</ol>
</div></div>


### Install using other package management

<ul class="nav nav-tabs" id="tabs-other-kubectl-install" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-other-kubectl-install-0" role="tab" aria-controls="tabs-other-kubectl-install-0" aria-selected="true">Snap</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-other-kubectl-install-1" role="tab" aria-controls="tabs-other-kubectl-install-1">Homebrew</a></li></ul>

<div class="tab-content" id="tabs-other-kubectl-install-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-other-kubectl-install-0" role="tabpanel" aria-labelledby="tabs-other-kubectl-install-0-tab" tabindex="other-kubectl-install"><p>If you are on Ubuntu or another Linux distribution that supports the
<a href="https://snapcraft.io/docs/core/install">snap</a> package manager, kubectl
is available as a <a href="https://snapcraft.io/">snap</a> application.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">snap install kubectl --classic
</span></span><span class="line"><span class="cl">kubectl version --client
</span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-other-kubectl-install-1" role="tabpanel" aria-labelledby="tabs-other-kubectl-install-1-tab" tabindex="other-kubectl-install"><p>If you are on Linux and using <a href="https://docs.brew.sh/Homebrew-on-Linux">Homebrew</a>
package manager, kubectl is available for <a href="https://docs.brew.sh/Homebrew-on-Linux#install">installation</a>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">brew install kubectl
</span></span><span class="line"><span class="cl">kubectl version --client
</span></span></code></pre></div></div></div>


## Verify kubectl configuration


	<p>In order for kubectl to find and access a Kubernetes cluster, it needs a
<a href="/docs/concepts/configuration/organize-cluster-access-kubeconfig/">kubeconfig file</a>,
which is created automatically when you create a cluster using
<a href="https://github.com/kubernetes/kubernetes/blob/master/cluster/kube-up.sh">kube-up.sh</a>
or successfully deploy a Minikube cluster.
By default, kubectl configuration is located at <code>~/.kube/config</code>.</p>
<p>Check that kubectl is properly configured by getting the cluster state:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">kubectl cluster-info
</span></span></code></pre></div><p>If you see a URL response, kubectl is correctly configured to access your cluster.</p>
<p>If you see a message similar to the following, kubectl is not configured correctly
or is not able to connect to a Kubernetes cluster.</p>
<pre tabindex="0"><code>The connection to the server &lt;server-name:port&gt; was refused - did you specify the right host or port?
</code></pre><p>For example, if you are intending to run a Kubernetes cluster on your laptop (locally),
you will need a tool like <a href="https://minikube.sigs.k8s.io/docs/start/">Minikube</a> to be
installed first and then re-run the commands stated above.</p>
<p>If <code>kubectl cluster-info</code> returns the url response, but you can't access your cluster,
check whether it is configured properly using the following command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">kubectl cluster-info dump
</span></span></code></pre></div><h3 id="no-auth-provider-found">Troubleshooting the 'No Auth Provider Found' error message<a class="td-heading-self-link" href="#no-auth-provider-found" aria-label="Heading self-link"></a></h3>
<p>In Kubernetes 1.26, kubectl removed the built-in authentication for the following cloud
providers' managed Kubernetes offerings. These providers have released kubectl plugins
to provide the cloud-specific authentication. For instructions, refer to the following provider documentation:</p>
<ul>
<li>Azure AKS: <a href="https://azure.github.io/kubelogin/">kubelogin plugin</a></li>
<li>Google Kubernetes Engine: <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin">gke-gcloud-auth-plugin</a></li>
</ul>
<p>There could also be other causes for the same error message that are unrelated
to that change.</p>


## Optional kubectl configurations and plugins

### Enable shell autocompletion

kubectl provides autocompletion support for Bash, Zsh, Fish, and PowerShell,
which can save you a lot of typing.

Below are the procedures to set up autocompletion for Bash, Fish, and Zsh.

<ul class="nav nav-tabs" id="tabs-kubectl-autocompletion" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-kubectl-autocompletion-0" role="tab" aria-controls="tabs-kubectl-autocompletion-0" aria-selected="true">Bash</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-kubectl-autocompletion-1" role="tab" aria-controls="tabs-kubectl-autocompletion-1">Fish</a></li>
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-kubectl-autocompletion-2" role="tab" aria-controls="tabs-kubectl-autocompletion-2">Zsh</a></li></ul>

<div class="tab-content" id="tabs-kubectl-autocompletion-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-kubectl-autocompletion-0" role="tabpanel" aria-labelledby="tabs-kubectl-autocompletion-0-tab" tabindex="kubectl-autocompletion"><h3 id="introduction">Introduction<a class="td-heading-self-link" href="#introduction" aria-label="Heading self-link"></a></h3>
<p>The kubectl completion script for Bash can be generated with the command <code>kubectl completion bash</code>.
Sourcing the completion script in your shell enables kubectl autocompletion.</p>
<p>However, the completion script depends on
<a href="https://github.com/scop/bash-completion"><strong>bash-completion</strong></a>,
which means that you have to install this software first
(you can test if you have bash-completion already installed by running <code>type _init_completion</code>).</p>
<h3 id="install-bash-completion">Install bash-completion<a class="td-heading-self-link" href="#install-bash-completion" aria-label="Heading self-link"></a></h3>
<p>bash-completion is provided by many package managers
(see <a href="https://github.com/scop/bash-completion#installation">here</a>).
You can install it with <code>apt-get install bash-completion</code> or <code>yum install bash-completion</code>, etc.</p>
<p>The above commands create <code>/usr/share/bash-completion/bash_completion</code>,
which is the main script of bash-completion. Depending on your package manager,
you have to manually source this file in your <code>~/.bashrc</code> file.</p>
<p>To find out, reload your shell and run <code>type _init_completion</code>.
If the command succeeds, you're already set, otherwise add the following to your <code>~/.bashrc</code> file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">source</span> /usr/share/bash-completion/bash_completion
</span></span></code></pre></div><p>Reload your shell and verify that bash-completion is correctly installed by typing <code>type _init_completion</code>.</p>
<h3 id="enable-kubectl-autocompletion">Enable kubectl autocompletion<a class="td-heading-self-link" href="#enable-kubectl-autocompletion" aria-label="Heading self-link"></a></h3>
<h4 id="bash">Bash<a class="td-heading-self-link" href="#bash" aria-label="Heading self-link"></a></h4>
<p>You now need to ensure that the kubectl completion script gets sourced in all
your shell sessions. There are two ways in which you can do this:</p>
<ul class="nav nav-tabs" id="tabs-kubectl-bash-autocompletion" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-kubectl-bash-autocompletion-0" role="tab" aria-controls="tabs-kubectl-bash-autocompletion-0" aria-selected="true">User</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-kubectl-bash-autocompletion-1" role="tab" aria-controls="tabs-kubectl-bash-autocompletion-1">System</a></li></ul>

<div class="tab-content" id="tabs-kubectl-bash-autocompletion-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-kubectl-bash-autocompletion-0" role="tabpanel" aria-labelledby="tabs-kubectl-bash-autocompletion-0-tab" tabindex="kubectl-bash-autocompletion"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s1">&#39;source &lt;(kubectl completion bash)&#39;</span> &gt;&gt;~/.bashrc
</span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-kubectl-bash-autocompletion-1" role="tabpanel" aria-labelledby="tabs-kubectl-bash-autocompletion-1-tab" tabindex="kubectl-bash-autocompletion"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">kubectl completion bash <span class="p">|</span> sudo tee /etc/bash_completion.d/kubectl &gt; /dev/null
</span></span><span class="line"><span class="cl">sudo chmod a+r /etc/bash_completion.d/kubectl
</span></span></code></pre></div></div></div>

<p>If you have an alias for kubectl, you can extend shell completion to work with that alias:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s1">&#39;alias k=kubectl&#39;</span> &gt;&gt;~/.bashrc
</span></span><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s1">&#39;complete -o default -F __start_kubectl k&#39;</span> &gt;&gt;~/.bashrc
</span></span></code></pre></div>
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>bash-completion sources all completion scripts in <code>/etc/bash_completion.d</code>.</div>

<p>Both approaches are equivalent. After reloading your shell, kubectl autocompletion should be working.
To enable bash autocompletion in current session of shell, source the ~/.bashrc file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">source</span> ~/.bashrc
</span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-kubectl-autocompletion-1" role="tabpanel" aria-labelledby="tabs-kubectl-autocompletion-1-tab" tabindex="kubectl-autocompletion">
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>Autocomplete for Fish requires kubectl 1.23 or later.</div>

<p>The kubectl completion script for Fish can be generated with the command <code>kubectl completion fish</code>. Sourcing the completion script in your shell enables kubectl autocompletion.</p>
<p>To do so in all your shell sessions, add the following line to your <code>~/.config/fish/config.fish</code> file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">kubectl completion fish <span class="p">|</span> <span class="nb">source</span>
</span></span></code></pre></div><p>After reloading your shell, kubectl autocompletion should be working.</p>
</div><div class="tab-body tab-pane fade"
        id="tabs-kubectl-autocompletion-2" role="tabpanel" aria-labelledby="tabs-kubectl-autocompletion-2-tab" tabindex="kubectl-autocompletion"><p>The kubectl completion script for Zsh can be generated with the command <code>kubectl completion zsh</code>. Sourcing the completion script in your shell enables kubectl autocompletion.</p>
<p>To do so in all your shell sessions, add the following to your <code>~/.zshrc</code> file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-zsh" data-lang="zsh"><span class="line"><span class="cl"><span class="nb">source</span> &lt;<span class="o">(</span>kubectl completion zsh<span class="o">)</span>
</span></span></code></pre></div><p>If you have an alias for kubectl, kubectl autocompletion will automatically work with it.</p>
<p>After reloading your shell, kubectl autocompletion should be working.</p>
<p>If you get an error like <code>2: command not found: compdef</code>, then add the following to the beginning of your <code>~/.zshrc</code> file:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-zsh" data-lang="zsh"><span class="line"><span class="cl">autoload -Uz compinit
</span></span><span class="line"><span class="cl">compinit
</span></span></code></pre></div></div></div>


### Configure kuberc

See [kuberc](/docs/reference/kubectl/kuberc) for more information.

### Install `kubectl convert` plugin


	<p>A plugin for Kubernetes command-line tool <code>kubectl</code>, which allows you to convert manifests between different API
versions. This can be particularly helpful to migrate manifests to a non-deprecated api version with newer Kubernetes release.
For more info, visit <a href="/docs/reference/using-api/deprecation-guide/#migrate-to-non-deprecated-apis">migrate to non deprecated apis</a></p>


1. Download the latest release with the command:

   <ul class="nav nav-tabs" id="tabs-download-convert-binary-linux" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-download-convert-binary-linux-0" role="tab" aria-controls="tabs-download-convert-binary-linux-0" aria-selected="true">x86-64</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-download-convert-binary-linux-1" role="tab" aria-controls="tabs-download-convert-binary-linux-1">ARM64</a></li></ul>

<div class="tab-content" id="tabs-download-convert-binary-linux-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-download-convert-binary-linux-0" role="tabpanel" aria-labelledby="tabs-download-convert-binary-linux-0-tab" tabindex="download-convert-binary-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/amd64/kubectl-convert&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-download-convert-binary-linux-1" role="tabpanel" aria-labelledby="tabs-download-convert-binary-linux-1-tab" tabindex="download-convert-binary-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/arm64/kubectl-convert&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div></div>


1. Validate the binary (optional)

   Download the kubectl-convert checksum file:

   <ul class="nav nav-tabs" id="tabs-download-convert-checksum-linux" role="tablist"><li class="nav-item"><a data-bs-toggle="tab" class="nav-link active" href="#tabs-download-convert-checksum-linux-0" role="tab" aria-controls="tabs-download-convert-checksum-linux-0" aria-selected="true">x86-64</a></li>
	  
		<li class="nav-item"><a data-bs-toggle="tab" class="nav-link" href="#tabs-download-convert-checksum-linux-1" role="tab" aria-controls="tabs-download-convert-checksum-linux-1">ARM64</a></li></ul>

<div class="tab-content" id="tabs-download-convert-checksum-linux-content"><div class="tab-body tab-pane fadeshow active"
        id="tabs-download-convert-checksum-linux-0" role="tabpanel" aria-labelledby="tabs-download-convert-checksum-linux-0-tab" tabindex="download-convert-checksum-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/amd64/kubectl-convert.sha256&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div><div class="tab-body tab-pane fade"
        id="tabs-download-convert-checksum-linux-1" role="tabpanel" aria-labelledby="tabs-download-convert-checksum-linux-1-tab" tabindex="download-convert-checksum-linux"><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">   curl -LO <span class="s2">&#34;https://dl.k8s.io/release/</span><span class="k">$(</span>curl -L -s https://dl.k8s.io/release/stable.txt<span class="k">)</span><span class="s2">/bin/linux/arm64/kubectl-convert.sha256&#34;</span>
</span></span><span class="line"><span class="cl">   </span></span></code></pre></div></div></div>


   Validate the kubectl-convert binary against the checksum file:

   ```bash
   echo "$(cat kubectl-convert.sha256) kubectl-convert" | sha256sum --check
   ```

   If valid, the output is:

   ```console
   kubectl-convert: OK
   ```

   If the check fails, `sha256` exits with nonzero status and prints output similar to:

   ```console
   kubectl-convert: FAILED
   sha256sum: WARNING: 1 computed checksum did NOT match
   ```

   
<div class="alert alert-info" role="note"><h4 class="alert-heading">Note:</h4>Download the same version of the binary and checksum.</div>


1. Install kubectl-convert

   ```bash
   sudo install -o root -g root -m 0755 kubectl-convert /usr/local/bin/kubectl-convert
   ```

1. Verify plugin is successfully installed

   ```shell
   kubectl convert --help
   ```

   If you do not see an error, it means the plugin is successfully installed.

1. After installing the plugin, clean up the installation files:

   ```bash
   rm kubectl-convert kubectl-convert.sha256
   ```

## What's next


	<ul>
<li>Learn about <a href="/docs/concepts/overview/kubectl/">kubectl</a> and its role in the Kubernetes ecosystem.</li>
<li><a href="https://minikube.sigs.k8s.io/docs/start/">Install Minikube</a></li>
<li>See the <a href="/docs/setup/">getting started guides</a> for more about creating clusters.</li>
<li><a href="/docs/tasks/access-application-cluster/service-access-application-cluster/">Learn how to launch and expose your application.</a></li>
<li>If you need access to a cluster you didn't create, see the
<a href="/docs/tasks/access-application-cluster/configure-access-multiple-clusters/">Sharing Cluster Access document</a>.</li>
<li>Read the <a href="/docs/reference/kubectl/kubectl/">kubectl reference docs</a></li>
</ul>
