Skip to content

Instantly share code, notes, and snippets.

@alexbegg
Created August 25, 2022 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexbegg/2451d8c42cfb7eca42a99e846976be9a to your computer and use it in GitHub Desktop.
Save alexbegg/2451d8c42cfb7eca42a99e846976be9a to your computer and use it in GitHub Desktop.
Install Kubectl and Helm on Windows

Install Kubectl and Helm on Windows

To make it easier to install and manage kubectl and helm on Windows I recommend using Chocolatey:

  1. Start a PowerShell terminal running as Administrator (this is needed for all Chocolatey commands).

  2. Install Chocolatey by following the directions on https://docs.chocolatey.org/en-us/choco/setup.

  3. Install the kubernetes-cli Chocolatey package to install kubectl:

    Note: Install a version that is within one minor version (older or newer) of the Kubernetes version the cluster uses (according to the Version Skew Policy of kubectl: https://kubernetes.io/releases/version-skew-policy/#kubectl). This is regardless if you use Chocolatey or some other method to install kubectl.

    1. View the list of kubernetes-cli versions that Chocolatey has and pick an appropriate version:

      choco list -e kubernetes-cli -a

      For example, if your cluster uses Kubernetes version 1.20.9 then pick a kubernetes-cli version from this list that is at least 1.19.0 and at most 1.21.14. Chocolatey does not have every version, but for each minor version it does have the first few patch version as well as the latest patch version.

    2. Install the specific version you want. (In this case I am installing the highest patch version available, 1.20.15, of the same 1.20 minor version of my Kubernetes cluster):

      choco install kubernetes-cli --version 1.20.15
  4. Install the kubernetes-helm Chocolatey package to install helm:

    choco install kubernetes-helm

Optional

  1. Install the Helm Diff Plugin to show a diff of changes prior to running an Helm chart upgrade.

    If you are on Windows the helm plugin install method as listed in the instructions on https://github.com/databus23/helm-diff won't work as it will install a Linux version instead of a Windows version. For Windows you need to do the following:

    1. Download the latest Windows release tarball from the plugin's releases page on GitHub.

    2. Using a PowerShell terminal run the following command to extract the file and place the plugin in your Helm plugins folder (replacing the download path with your actual file download path):

      tar -C $env:APPDATA\helm\plugins -xzf <download path of helm-diff-windows-amd64.tgz...>

Tips

  1. Make sure you always run Chocolatey (choco) commands in a terminal running as Administrator.

  2. To view the Chocolatey packages you have installed locally run the command:

    choco list --local-only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment