--- layout: docs page_title: Install Consul on K8s CLI description: >- You can use the Consul K8s CLI tool to schedule Kubernetes deployments instead of using Helm. Learn how to download and install the tool to interact with Consul on Kubernetes using the `consul-k8s` command. --- # Install Consul on K8s CLI Consul K8s CLI is a tool for quickly installing and interacting with Consul on Kubernetes. Ensure that you are installing the correct version of the CLI for your Consul on Kubernetes deployment, as the CLI and the control plane are version dependent. ## Install the 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. The [Homebrew](https://brew.sh) 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 [Install a specific version of Consul K8s CLI](#install-a-specific-version-of-the-cli). 1. Install the HashiCorp `tap`, which is a repository of all Homebrew packages for HashiCorp: ```shell-session $ brew tap hashicorp/tap ``` 1. Install the Consul K8s CLI with `hashicorp/tap/consul` formula. ```shell-session $ brew install hashicorp/tap/consul-k8s ``` 1. 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: ```shell-session $ consul-k8s install ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation: ```shell-session $ consul-k8s version consul-k8s 0.39.0 ``` 1. Add the HashiCorp GPG key. ```shell-session $ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ``` 1. Add the HashiCorp apt repository. ```shell-session $ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ``` 1. Run apt-get install to install the `consul-k8s` CLI. ```shell-session $ sudo apt-get update && sudo apt-get install consul-k8s ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation. ```shell-session $ consul-k8s version consul-k8s 0.39.0 ``` 1. Install `yum-config-manager` to manage your repositories. ```shell-session $ sudo yum install -y yum-utils ``` 1. Use `yum-config-manager` to add the official HashiCorp Linux repository. ```shell-session $ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo ``` 1. Install the `consul-k8s` CLI. ```shell-session $ sudo yum -y install consul-k8s ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation. ```shell-session $ consul-k8s version 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. ```shell-session $ export VERSION=0.39.0 && \ curl --location "https://releases.hashicorp.com/consul-k8s/${VERSION}/consul-k8s_${VERSION}_darwin_amd64.zip" --output consul-k8s-cli.zip ``` 1. 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. ```shell-session $ unzip -o consul-k8s-cli.zip -d ~/.consul-k8s ``` 1. Add the path to your directory. In order to persist the `$PATH` across sessions, you will need to add this to your shellrc (i.e. shell run commands) file for the shell used by your terminal. ```shell-session $ export PATH=$PATH:$HOME/.consul-k8s/ ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation. ```shell-session $ consul-k8s version consul-k8s 0.39.0 ``` 1. Add the HashiCorp GPG key. ```shell-session $ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ``` 1. Add the HashiCorp apt repository. ```shell-session $ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ``` 1. Run apt-get install to install the `consul-k8s` CLI. ```shell-session $ export VERSION=0.39.0 && \ sudo apt-get update && sudo apt-get install consul-k8s=${VERSION} ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation. ```shell-session $ consul-k8s version consul-k8s 0.39.0 ``` 1. Install `yum-config-manager` to manage your repositories. ```shell-session $ sudo yum install -y yum-utils ``` 1. Use `yum-config-manager` to add the official HashiCorp Linux repository. ```shell-session $ sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo ``` 1. Install the `consul-k8s` CLI. ```shell-session $ export VERSION=-0.39.0 && \ sudo yum -y install consul-k8s-${VERSION}-1 ``` 1. (Optional) Issue the `consul-k8s version` command to verify the installation. ```shell-session $ consul-k8s version consul-k8s 0.39.0 ```