Installing the Consul K8s CLI

    These instructions describe how to install the latest version of the CLI depending on your Operating System, and are suited for fresh installations of Consul on Kubernetes.

    Installing Consul K8s CLI - 图2

    The Homebrew package manager is required to complete the following installation instructions. The Homebrew formulae will always install the latest version of a binary. If you are looking to install a specific version of the CLI please follow .

      1. $ brew tap hashicorp/tap
    1. Install the Consul K8s CLI with hashicorp/tap/consul formula.

      1. $ brew install hashicorp/tap/consul-k8s
      1. $ brew install hashicorp/tap/consul-k8s
    2. If you have already provisioned a Kubernetes cluster and have already configured access to the cluster via a kubeconfig file, you are ready to install Consul K8s. Issue the install subcommand to install Consul on Kubernetes:

      1. (Optional) Issue the consul-k8s version command to verify the installation:

        1. consul-k8s 0.39.0
        1. $ consul-k8s version
        2. consul-k8s 0.39.0

      Install a specific version of the CLI

      These instructions describe how to install a specific version of the CLI and are best suited for installing or managing specific versions of the Consul on Kubernetes control plane.

      Homebrew does not provide a method to install previous versions of a package. The Consul K8s CLI will need to be installed manually. Previous versions of the Consul K8s CLI could be used to install a specific version of Consul on the Kubernetes control plane. Manual upgrades to the Consul K8s CLI is also performed in the same manner, provided that the Consul K8s CLI was manually installed before.

      1. Download the desired Consul K8s CLI using the following curl command. Enter the appropriate version for your deployment via the $VERSION environment variable.

        1. $ export VERSION=0.39.0 && \
        2. curl --location "https://releases.hashicorp.com/consul-k8s/${VERSION}/consul-k8s_${VERSION}_darwin_amd64.zip" --output consul-k8s-cli.zip
      2. Unzip the zip file output to extract the consul-k8s CLI binary. This overwrites existing files and also creates a .consul-k8s subdirectory in your $HOME folder.

        1. $ unzip -o consul-k8s-cli.zip -d ~/.consul-k8s
        1. $ export PATH=$PATH:$HOME/.consul-k8s/
        1. $ export PATH=$PATH:$HOME/.consul-k8s/
      3. (Optional) Issue the consul-k8s version command to verify the installation.