How Do I Set Up Kubectl for MoonQube

Kubectl is used to access and manage your Kubernetes cluster. You can install kubectl to WSL (Windows Subsystem for Linux) or Linux using these instructions.

Install kubectl on Linux


Our instructions are for installing kubectl from binary so that you can get the latest stable version and not use the older versions in your native package management.

  1. Download the latest release of kubectl

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

Note:

To download a specific version, replace the command's $(curl -L -s https://dl.k8s.io/release/stable.txt) portion with the specific version.

For example, to download version 1.27.3 on Linux x86-64, type:

curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl

  1. Validate the binary (optional)

curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"

Validate the kubectl binary against the checksum file:

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

The output should be the following if the file is valid:

kubectl: OK

  1. Install kubectl

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


Link kubectl to Your Cluster


  1. Open the Kubernetes page in the console and select your cluster
  2. Click Get Configuration and input the API User and API User password used to deploy the cluster

  3. In your Linux install where you setup kubectl run the following command to create the config file.

nano ~/.kube/config

4. Paste in the contents of the download config and then save the file

  1. Run the following command to verify cluster connectivity

kubectl cluster-info

The output should report

Kubernetes control plane is running at <address of your control plane>

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us