--- layout: docs page_title: Consul K8s CLI Reference description: >- Consul K8s CLI is a tool for quickly installing and interacting with Consul on Kubernetes. --- # Consul K8s CLI Reference Consul K8s CLI is a tool for quickly installing and interacting with Consul on Kubernetes. This topic describes the commands, subcommands, and available options for using Consul K8s CLI. ~> Consul K8s CLI is is currently availabe as an alpha release and is not recommended for production environments. ## Download and Build the Binary 1. Clone the [consul-k8s-cli](https://github.com/hashicorp/consul-k8s-cli) project. 1. Navigate to the `consul-k8s-cli` directory and issue the following command to build the tool: ```shell-session go build -o bin/consul-k8s ``` ## Usage Consul K8s CLI uses the following syntax: ```shell-session consul-k8s ``` ## Subcommands You can use the following subcommands with `consul-k8s`. ### `install` The `install` command installs Consul on Kubernetes. ```shell-session consul-k8s install ``` The following options are available. | Flag | Description | Default | Required | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------- | | `-auto-approve`                   | Boolean value that enables you to skip the installation confirmation prompt. | `false` | Optional | | `-dry-run` | Boolean value that validates the installation and returns a summary. | `false` | Optional | | `-name` | String value for the name of the installation. The specified value will be prefixed to resources installed on the cluster. | none | Optional | | `-namespace` | String value that specifies the namespace of the Consul installation. | `consul` | Optional | | `-preset` | String value that installs Consul based on a preset configuration. You can specify the following values:
`demo`: Installs a single replica server with sidecar injection enabled; useful for testing service mesh functionality.
`secure`: Installs a single replica server with sidecar injection, ACLs, and TLS enabled; useful for testing service mesh functionality. | Configuration of the Consul Helm chart. | Optional | | `-set` | String value that enables you to set a customizeable value.
You can use the `-set` flag multiple times to set multiple values.
Consul Helm chart values are supported. | none | Optional | | `-set-file` | String value that specifies the name of a file. The contents of the file will be used to set a customizeable value.
You can use the `-set-file` flag multiple times to specify multiple files.
Consul Helm chart values are supported. | none | Optional | | `-set-string` | String value that enables you to set a customizeable string value.
You can use the `-set-string` flag multiple times to specify multiple strings.
Consul Helm chart values are supported. | none | Optional | See [Global Options](#global-options) for additional commands that you can use when installing Consul on Kubernetes. #### Example Command The following example command installs Consul according in the `myNS` namespace according to the `secure` preset. ```shell-session consul-k8s install -preset=secure -namespace=myNS ``` ### `uninstall` The `uninstall` command removes Consul from Kubernetes. ```shell-session consul-k8s uninstall ``` The following options are available. | Flag | Description | Default | Required | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | -------- | | `-skip-confirm`                   | Boolean value that enables you to skip the removal confirmation prompt. | `false` | Optional | | `-name` | String value for the name of the installation to remove. | none | Optional | | `-namespace` | String value that specifies the namespace of the Consul installation to remove. | `consul` | Optional | | `-auto-approve-wipe-data` | Boolan value that disables the prompt verifying that PVCs, secrets, and service accounts associated with the Consul installation _will be deleted_.
This flag cannot be applied if `auto-approve-skip-wipe-data` is also used. | `false`
A prompt will appear verifying that you want to delete data. | Optional | | `-auto-approve-skip-wipe-data` | Boolan value that disables the prompt verifying that PVCs, secrets, and service accounts associated with the Consul installation _will be retained_.
This flag cannot be applied if `auto-approve-wipe-data` is also used. | `false`
A prompt will appear verifying that you want to delete data. | Optional | See [Global Options](#global-options) for additional commands that you can use when uninstalling Consul from Kubernetes. #### Example Command The following example command uninstalls Consul from the `my-ns` namespace with the name `my-consul`. ```shell-session consul-k8s uninstall -name=my-consul -namespace=my-ns ``` ## Global Options The following global options are available. | Flag | Description | Default | Required | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------- | -------- | | `-context`                   | String value that sets the Kubernetes context to use for Consul K8s CLI operations. | none | Optional | | `-kubeconfig` | String value that specifies the path to the `kubeconfig` file.
The file is aliased as `-c` | none | Optional |