Install Kubectl by downloading precompiled binaries.

Install kubectl binary with curl on Linux / macOS

  1. Define the following variable by OS:

    • Linux:

      export os="linux/amd64"
    • macOS with an Intel core:

      export os="darwin/amd64"
    • macOS with an Apple Silicon core:

      export os="darwin/arm64"
  2. Download the latest release with the command:

    curl -LO "$(curl -s$os/kubectl"

    To download a specific version, replace the $(curl -s portion of the command with the specific version.

    For example, to download version v1.19.0 on Linux, type:

    curl -LO "$os/kubectl"
  3. Make the kubectl binary executable.

    chmod +x ./kubectl
  4. Move the binary in to your PATH.

    sudo mv ./kubectl /usr/local/bin/kubectl
  5. Test to ensure the version you installed is up-to-date:

    kubectl version --client

Last modified March 31, 2022: Fix issue #260 (5e8e26a)