Install and Set Up Kubectl

The Kubernetes command line tool, kubectl allows you to run commands against Kubernetes clusters. You can use kuberctl to deploy applications, inspect and manage cluster resources and view logs. See Overview of kubectl for more.

Install kubectl on Linux:

Install kubectl binary with curl on Linux.

  • Download the latest release with the command:
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
  • Make the kubectl binary executable:
chmod +x ./kubectl
  • Move the binary in to your PATH:
sudo mv ./kubectl /usr/local/bin/kubectl
  • Test to ensure the version you installed is up-to-date:
kubectl version --client

Install kubectl on macOS:

Install kubectl binary with curl on macOS.

  • Download the latest release:
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl"
  • Make the kubectl binary executable:
chmod +x ./kubectl
  • Move the binary in to your PATH:
sudo mv ./kubectl /usr/local/bin/kubectl

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

kubectl version --client