Consul K8s CLI Reference
Note: For guidance on how to install the Consul K8s CLI, visit the Installing the Consul K8s CLI documentation.
This topic describes the subcommands and available options for using Consul K8s CLI.
Consul K8s CLI uses the following syntax:
$ consul-k8s <SUBCOMMAND> <OPTIONS>
You can use the following subcommands with consul-k8s
.
The install
command installs Consul on Kubernetes.
$ consul-k8s install <OPTIONS>
$ consul-k8s install <OPTIONS>
The following options are available.
Example Commands
The following example command installs Consul according in the myNS
namespace according to the secure
preset.
$ consul-k8s install -preset=secure -namespace=myNS
$ consul-k8s install -preset=secure -namespace=myNS
The following example commands install Consul on Kubernetes using custom values, files, or strings that are set via flags. The underlying Consul-on-Kubernetes Helm chart uses the flags to customize the installation. The flags are comparable to the helm install
.
$ consul-k8s install -set key=value
$ consul-k8s install -set key=value
$ consul-k8s install -set key1=value1 -set key2=value2
$ consul-k8s install -set key1=value1 -set key2=value2
$ consul-k8s install -set-file config1=value1.conf
$ consul-k8s install -set-file config1=value1.conf -set-file config2=value2.conf
$ consul-k8s install -set-file config1=value1.conf -set-file config2=value2.conf
$ consul-k8s install -set-string key=value-bool
$ consul-k8s install -set-string key=value-bool
The uninstall
command removes Consul from Kubernetes.
$ consul-k8s uninstall <OPTIONS>
$ consul-k8s uninstall <OPTIONS>
The following options are available.
See Global Options for additional commands that you can use when uninstalling Consul from Kubernetes.
Example Command
The following example command immediately uninstalls Consul from the my-ns
namespace with the name my-consul
and removes PVCs and secrets associated with the installation without asking for verification:
$ consul-k8s uninstall -namespace=my-ns -name=my-consul -wipe-data=true -auto-approve=true
$ consul-k8s uninstall -namespace=my-ns -name=my-consul -wipe-data=true -auto-approve=true
Example Command
$ consul-k8s status
==> Consul-K8s Status Summary
NAME | NAMESPACE | STATUS | CHARTVERSION | APPVERSION | REVISION | LAST UPDATED
---------+-----------+----------+--------------+------------+----------+--------------------------
consul | consul | deployed | 0.41.1 | 1.11.4 | 1 | 2022/03/10 07:48:58 MST
==> Config:
connectInject:
enabled: true
metrics:
defaultEnableMerging: true
defaultEnabled: true
enableGatewayMetrics: true
controller:
enabled: true
global:
metrics:
enableAgentMetrics: true
enabled: true
name: consul
prometheus:
enabled: true
server:
replicas: 1
ui:
enabled: true
service:
enabled: true
✓ Consul servers healthy (1/1)
✓ Consul clients healthy (3/3)
$ consul-k8s status
NAME | NAMESPACE | STATUS | CHARTVERSION | APPVERSION | REVISION | LAST UPDATED
---------+-----------+----------+--------------+------------+----------+--------------------------
consul | consul | deployed | 0.41.1 | 1.11.4 | 1 | 2022/03/10 07:48:58 MST
==> Config:
connectInject:
enabled: true
metrics:
defaultEnableMerging: true
defaultEnabled: true
controller:
enabled: true
global:
metrics:
enableAgentMetrics: true
enabled: true
name: consul
prometheus:
enabled: true
server:
replicas: 1
ui:
enabled: true
service:
enabled: true
✓ Consul servers healthy (1/1)
✓ Consul clients healthy (3/3)
The consul-k8s upgrade
subcommand is currently in beta: This subcommand is not recommended for production environments.
The upgrade
command upgrades the Consul on Kubernetes components to the current version of the consul-k8s
cli. Prior to running consul-k8s upgrade
, the consul-k8s
CLI should first be upgraded to the latest version as described
$ consul-k8s upgrade
$ consul-k8s upgrade
The following options are available.
See Global Options for additional commands that you can use when installing Consul on Kubernetes.
The version
command prints the Consul on Kubernetes version. This command does not take any options.
$ consul-k8s version
$ consul-k8s version
You can also print the version with the --version
flag.
$ consul-k8s --version