Kubernetes: Install kubectl
kubectl is the command line tool that talks to every Kubernetes cluster. You install it once, and it works with any cluster you connect it to.
Check the version
The version command proves the tool is installed. It prints the client version.
kubectl version --clientCheck the connection
The cluster info command proves the tool can reach a cluster. It prints the control plane address.
kubectl cluster-infoList the nodes
The get nodes command lists the machines in the cluster. A healthy node shows Ready.
kubectl get nodesInstall on Linux
Linux installs kubectl from the official package source or as a downloaded binary. The version is 1.37.1.
kubectl version --clientExample
kubectl version --client
kubectl cluster-infoKey points
- kubectl: the command line tool that sends requests to the API server.
- Version match: kubectl should stay close to the cluster version, here 1.37.1.
- Binary: a single file you download and place on your path.
- Use kubectl version to check the tool is installed and working.
- Use kubectl cluster-info to check the tool can reach a cluster.
In this example, the first command prints the kubectl client version. The output shows v1.37.1, so the tool is installed. The second command prints the control plane address, so the tool can reach a cluster.
Note
kubectl cannot run in the browser, so lesson examples are command transcripts with stated outputs.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What does kubectl do?