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:

    1. $ consul-k8s <SUBCOMMAND> <OPTIONS>

    You can use the following subcommands with consul-k8s.

    The install command installs Consul on Kubernetes.

    1. $ consul-k8s install <OPTIONS>
    1. $ 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.

    1. $ consul-k8s install -preset=secure -namespace=myNS
    1. $ 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 .

    1. $ consul-k8s install -set key=value
    1. $ consul-k8s install -set key=value
    1. $ consul-k8s install -set key1=value1 -set key2=value2
    1. $ consul-k8s install -set key1=value1 -set key2=value2
    1. $ consul-k8s install -set-file config1=value1.conf
    1. $ consul-k8s install -set-file config1=value1.conf -set-file config2=value2.conf
    1. $ consul-k8s install -set-file config1=value1.conf -set-file config2=value2.conf
    1. $ consul-k8s install -set-string key=value-bool
    1. $ consul-k8s install -set-string key=value-bool

    The uninstall command removes Consul from Kubernetes.

    1. $ consul-k8s uninstall <OPTIONS>
    1. $ 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:

    1. $ consul-k8s uninstall -namespace=my-ns -name=my-consul -wipe-data=true -auto-approve=true
    1. $ consul-k8s uninstall -namespace=my-ns -name=my-consul -wipe-data=true -auto-approve=true

      Example Command

      1. $ consul-k8s status
      2. ==> Consul-K8s Status Summary
      3. NAME | NAMESPACE | STATUS | CHARTVERSION | APPVERSION | REVISION | LAST UPDATED
      4. ---------+-----------+----------+--------------+------------+----------+--------------------------
      5. consul | consul | deployed | 0.41.1 | 1.11.4 | 1 | 2022/03/10 07:48:58 MST
      6. ==> Config:
      7. connectInject:
      8. enabled: true
      9. metrics:
      10. defaultEnableMerging: true
      11. defaultEnabled: true
      12. enableGatewayMetrics: true
      13. controller:
      14. enabled: true
      15. global:
      16. metrics:
      17. enableAgentMetrics: true
      18. enabled: true
      19. name: consul
      20. prometheus:
      21. enabled: true
      22. server:
      23. replicas: 1
      24. ui:
      25. enabled: true
      26. service:
      27. enabled: true
      28. Consul servers healthy (1/1)
      29. Consul clients healthy (3/3)
      1. $ consul-k8s status
      2. NAME | NAMESPACE | STATUS | CHARTVERSION | APPVERSION | REVISION | LAST UPDATED
      3. ---------+-----------+----------+--------------+------------+----------+--------------------------
      4. consul | consul | deployed | 0.41.1 | 1.11.4 | 1 | 2022/03/10 07:48:58 MST
      5. ==> Config:
      6. connectInject:
      7. enabled: true
      8. metrics:
      9. defaultEnableMerging: true
      10. defaultEnabled: true
      11. controller:
      12. enabled: true
      13. global:
      14. metrics:
      15. enableAgentMetrics: true
      16. enabled: true
      17. name: consul
      18. prometheus:
      19. enabled: true
      20. server:
      21. replicas: 1
      22. ui:
      23. enabled: true
      24. service:
      25. enabled: true
      26. Consul servers healthy (1/1)
      27. 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

      1. $ consul-k8s upgrade
      1. $ 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.

      1. $ consul-k8s version
      1. $ consul-k8s version

      You can also print the version with the --version flag.

      1. $ consul-k8s --version