Binaries

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 "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/$os/kubectl"
    

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

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

    curl -LO "https://dl.k8s.io/release/v1.19.0/bin/$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