Install the kubectl Command Line (2024)

In order to start working on a Kubernetes cluster, it is necessary to install the Kubernetes command line (kubectl). Follow these steps to install the kubectl CLI:

  • Execute the following commands to install the kubectl CLI. OS_DISTRIBUTION is a placeholder for the binary distribution of kubectl, remember to replace it with the corresponding distribution for your Operating System (OS).

     $ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/OS_DISTRIBUTION/amd64/kubectl $ chmod +x ./kubectl $ sudo mv ./kubectl /usr/local/bin/kubectl

    TIP: Once the kubectl CLI is installed, you can obtain information about the current version with the kubectl version command.

    NOTE: You can also install kubectl by using the sudo apt-get install kubectl command.

  • Check that kubectl is correctly installed and configured by running the kubectl cluster-info command:

     $ kubectl cluster-info

    NOTE: The kubectl cluster-info command shows the IP addresses of the Kubernetes node master and its services.

    Install the kubectl Command Line (1)

  • You can also verify the cluster by checking the nodes. Use the following command to list the connected nodes:

     $ kubectl get nodes

    Install the kubectl Command Line (2)

  • To get complete information on each node, run the following:

     $ kubectl describe node

    Install the kubectl Command Line (3)

Learn more about the kubectl CLI.

Install the kubectl Command Line (2024)

FAQs

Install the kubectl Command Line? ›

To install or update kubectl on Windows

Open a PowerShell terminal. Download the kubectl binary for your cluster's Kubernetes version from Amazon S3. (Optional) Verify the downloaded binary with the SHA-256 checksum for your binary. Download the SHA-256 checksum for your cluster's Kubernetes version for Windows.

How do I install kubectl on a local machine? ›

To install or update kubectl on Windows

Open a PowerShell terminal. Download the kubectl binary for your cluster's Kubernetes version from Amazon S3. (Optional) Verify the downloaded binary with the SHA-256 checksum for your binary. Download the SHA-256 checksum for your cluster's Kubernetes version for Windows.

How do you check if the kubectl command is installed? ›

Verifying the Kubectl command

To verify that the Kubectl command is recognized by your system, simply type `kubectl` in your terminal. If you're using iTerm, a valid command will be highlighted in green. This indicates that the command is found in your system's PATH and is ready to be executed.

How to install kubectl cli on ubuntu? ›

Install Kubectl on Ubuntu 22.04
  1. Step 1 - Download the Kubectl binary.
  2. Step 2 - Make the Kubectl binary executable.
  3. Step 3 - Move Kubectl binary to PATH.
  4. Step 1 - Add Kubernetes repository's GPG (GNU Privacy Guard) key.
  5. Step 2 - Add the Kubernetes repository to your system's sources. ...
  6. Step 3 - Update system packages.
Jun 9, 2023

Can I install Kubernetes locally? ›

Like kind , minikube is a tool that lets you run Kubernetes locally. minikube runs an all-in-one or a multi-node local Kubernetes cluster on your personal computer (including Windows, macOS and Linux PCs) so that you can try out Kubernetes, or for daily development work.

How to install kubectl on PowerShell? ›

Install kubectl on Windows
  1. Using Command Prompt to manually compare CertUtil 's output to the checksum file downloaded: CertUtil -hashfile kubectl.exe SHA256 type kubectl.exe.sha256.
  2. Using PowerShell to automate the verification using the -eq operator to get a True or False result:
Mar 7, 2024

How to run kubectl commands in Linux? ›

  1. Install Tools. Install and Set Up kubectl on Linux. Changing The Kubernetes Package Repository. Migrate Kubernetes Objects Using Storage Version Migration.
  2. Updating Configuration via a ConfigMap.
  3. Kubelet Configuration Directory Merging. kubectl cluster-info. kubectl cluster-info dump.
Mar 13, 2024

How to check kubectl version in cmd? ›

To check the version of kubectl you can use the kubectl version command the same command would return the version of Kubernetes cluster too.

Where do I run Kubernetes commands? ›

Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API. This tool is named kubectl . For configuration, kubectl looks for a file named config in the $HOME/.kube directory.

How to install Git using terminal in Mac? ›

Git for Mac Installer
  1. Download the latest Git for Mac installer.
  2. Follow the prompts to install Git.
  3. Open a terminal and verify the installation was successful by typing git --version :

How to install Git Bash in Mac terminal? ›

Install Git on Mac
  1. Navigate to the latest macOS Git Installer and download the latest version.
  2. Once the installer has started, follow the instructions as provided until the installation is complete.
  3. Open the command prompt "terminal" and type git version to verify Git was installed.

What does kubectl stand for? ›

Kubectl stands for “Kubernetes Command-line interface”. It is a command-line tool for the Kubernetes platform to perform API calls. Kubectl is the main interface that allows users to create (and manage) individual objects or groups of objects inside a Kubernetes cluster.

How to install from command line Ubuntu? ›

GEEKY: Ubuntu has by default something called APT. To install any package, just open a terminal ( Ctrl + Alt + T ) and type sudo apt-get install <package name> . For instance, to get Chrome type sudo apt-get install chromium-browser . SYNAPTIC: Synaptic is a graphical package management program for apt.

How do I install and run Kubernetes on Ubuntu? ›

  1. Step 1 - Update Ubuntu. Always recommended updating the system packages. ...
  2. Step 2 - Install Docker. ...
  3. Step 3 - Start and Enable Docker. ...
  4. Step 4 - Install Kubernetes. ...
  5. Step 5 - Add Software Repositories. ...
  6. Step 6 - Kubernetes Installation Tools. ...
  7. Step 7 - Kubernetes Deployment. ...
  8. Step 8 - Assign Unique Hostname for Each Server Node.

How to install kubelet on Ubuntu? ›

Adding worker nodes.
  1. Step 1: Disable swap.
  2. Step 2: Set up hostnames.
  3. Step 3: Update the /etc/hosts File for Hostname Resolution.
  4. Step 4: Set up the IPV4 bridge on all nodes.
  5. Step 5: Install kubelet, kubeadm, and kubectl on each node.
  6. Step 6: Install Docker.
  7. Step 7: Initialize the Kubernetes cluster on the master node.
Sep 8, 2023

How do I setup Kubernetes locally on Windows? ›

  1. Installing Kubernetes on Windows. Step 1: Enable Hyper-V. Step 2: Install Docker for Windows. Step 3: Install Kubernetes. Via Docker GUI. Via Minikube. Via Kind (Kubernetes in Docker) Step 4: Install Kubernetes Dashboard.
  2. How to Uninstall Kubernetes on Windows.
Jun 23, 2022

How to install Kubernetes on Linux offline? ›

Installing Kubernetes and Docker in offline scenarios
  1. Download and Install Docker.
  2. Download Docker (online machine/Docker host)
  3. Download Kubernetes (online machine/Docker host)
  4. Copy the Docker files from the online machine to the offline machine.
  5. Install Docker (offline machine)
  6. Install Kubernetes (offline machine)
Oct 11, 2022

How to install Kubernetes on Linux machine? ›

How to install Kubernetes
  1. Install MicroK8s on Linux. sudo snap install microk8s --classic. ...
  2. Add your user to the microk8s admin group. ...
  3. Check the status while Kubernetes starts. ...
  4. Turn on the services you want. ...
  5. Start using Kubernetes. ...
  6. Access the Kubernetes dashboard. ...
  7. Start and stop Kubernetes to save battery.

Which command can be used to install the kubectl client on a client machine? ›

NOTE: You can also install kubectl by using the sudo apt-get install kubectl command. NOTE: The kubectl cluster-info command shows the IP addresses of the Kubernetes node master and its services.

Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6678

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.