Kubectl and Helm are two tools (among others) that can be used with the Kube configuration file to manage and/or deploy your applications. The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. Helm is a package manager for Kubernetes, meaning that its main purpose is to simplify the deployment of applications in your cluster, but not to manage the cluster itself.

The two tools can be installed and used in the same machine, they co-exist and do not interfere with each other.

Install Kubectl

Follow the official installation page at https://kubernetes.io/docs/tasks/tools/#kubectl

Note that, as stated on the kubectl website: “You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.26 client can communicate with v1.25, v1.26, and v1.27 control planes.”

Before installing kubectl check the version of your cluster in CloudNativeLab. It is shown during the deployment phase and always available in Details in the Manage existing clusters tile.

  • Install kubectl on Linux
  • Install kubeclt on macOS
  • Install kubectl on Windows

Install Kubectl on Linux

  1. Download the specific release replacing <kubectl-version>with the version you would like to download (i.e. […]/release/v1.26.0/bin/[…])
curl -LO https://dl.k8s.io/release/<kubectl-version>/bin/linux/amd64/kubectl
  1. Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  1. Test kubectl
kubectl version --client

Install Kubectl on macOS

  1. Download the specific release based on your CPU, replacing <kubectl-version>with the version you would like to download (i.e. […]/release/v1.26.0/bin/[…])

Intel

curl -LO "https://dl.k8s.io/release/<kubectl-version>/bin/darwin/amd64/kubectl"

Apple Silicon

curl -LO "https://dl.k8s.io/release/<kubectl-version>/bin/darwin/arm64/kubectl"
  1. Make the binary executable and move it on your system PATH
chmod +x ./kubectl

sudo mv ./kubectl /usr/local/bin/kubectl
sudo chown root: /usr/local/bin/kubectl
  1. Test kubectl
kubectl version --client

Install Kubectl on Windows

  1. Download the specific release, replacing <kubectl-version>with the version you would like to download (i.e. […]/release/v1.26.0/bin/[…])
curl.exe -LO "https://dl.k8s.io/release/<kubectl-version>/bin/windows/amd64/kubectl.exe"
  1. Append or prepend the kubectl binary folder to your PATH environment variable.
  1. Test kubectl
kubectl version --client

Configure Kubectl

After creating your Kubernetes cluster you will receive a kubeconfig file. Copy this file to ~/.kube. For Windows users $HOME is equal to the %userprofile%/.kube directory. Rename the file to config and you are good to go.

You can now run kubectl commands and access the cluster:

kubectl get all

Install Helm

Several official methods are available to install the latest version of Helm based on your OS (no specific version is required based on your Kubernetes version).

We report the two official methods, for a specific OS installation through package manager, check https://helm.sh/docs/intro/install/

Install Helm from Binary Release

  1. Download the desired version at https://github.com/helm/helm/releases
  2. Unpack it
  3. Find the helm binary in the unpacked directory, and move it to its desired destination
  4. Test Helm
helm help

Install Helm from Script

Run the following commands to install Helm from script

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

Configure Helm

Helm uses the same Kube configuration file and looks for it in the same location as kubectl. We therefore repeat the same procedure, but if you already set up Kubectl, no additional steps are required.

After creating your Kubernetes cluster you will receive a kubeconfig file. Copy this file to ~/.kube. For Windows users $HOME is equal to the %userprofile%/.kube directory. Rename the file to config and you are good to go.

The cluster is ready!

At this stage the cluster is ready, turn on the VPN and start using one of the tools to manage your cluster or deploy your applications.

OpenCloudification Asks

Which Open Cloud Technologies are you using or considering to use?