Download and Install kubectl Command Line

Kubernetes provides a command-line interface (CLI) called kubectl to deploy, troubleshoot, and manage applications. Before you can use kubectl, you must ensure you can authenticate with the cluster's API server. Your credentials are distributed in a file called a kubeconfig, which is read by kubectl.

You must first download the kubeconfig that can be used by kubectl.

Make kubeconfig discoverable by kubectl

kubectl reads the file ~/.kube/config, by default.

Platform9 recommends you to place your kubeconfig under~/.kube/config. Otherwise, you can pass kubectl the option --kubeconfig

Download kubectl

kubectl is an executable binary built specifically for combinations of OS and CPU architectures.

Before you can download kubectl, you must identify the version of kubectl to download. The kubectl version must match the Kubernetes version of your cluster.

Follow the steps given below to identify the Kubernetes version of your cluster.

  1. Navigate to Infrastructure > Clusters on the Platform9 Clarity UI. check Kubernetes version
  2. Check the value in the Kubernetes version column for your cluster.

If you are using Linux, you can download kubectl, make it executable, and move it to /usr/local/bin by using the following commands. curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release//bin/linux/amd64/kubectl chmod +x kubectl && sudo mv kubectl /usr/local/bin/

To install kubectl on other operating systems, refer to Kubernetes documentation.