Consul on Kubernetes CLI Reference

The Consul on Kubernetes CLI, consul-k8s, is a tool for managing Consul that does not require direct interaction with Helm, the Consul CLI, or kubectl.

For guidance on how to install consul-k8s, refer to the Installing the Consul K8s CLI documentation.

This topic describes the commands and available options for using consul-k8s.

Usage

The Consul on Kubernetes CLI uses the following syntax:

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

Commands

You can use the following commands with consul-k8s.

  • config: Interact with helm configuration.
    • config read: Read helm configuration of a Consul installation.
  • install: Install Consul on Kubernetes.
  • proxy: Inspect Envoy proxies managed by Consul.
    • proxy list: List all Pods running proxies managed by Consul.
    • proxy read: Inspect the Envoy configuration for a given Pod.
    • proxy log: Inspect and modify the Envoy logging configuration for a given Pod.
  • status: Check the status of a Consul installation on Kubernetes.
  • troubleshoot: Troubleshoot Consul service mesh and networking issues from a given pod.
  • uninstall: Uninstall Consul deployment.
  • upgrade: Upgrade Consul on Kubernetes from an existing installation.
  • version: Print the version of the Consul on Kubernetes CLI.

config

The config command exposes the read subcommand that allows to read the helm configuration of a Consul installation.

  • config read: Read helm configuration of a Consul installation.

config read

  1. $ consul-k8s config read <OPTIONS>
FlagDescriptionDefault
-all-namespaces, -ABoolean List pods in all Kubernetes namespaces.false
-namespace, -nString The Kubernetes namespace to list proxies in.Current kubeconfig namespace.

Refer to the Global Options for additional options that you can use when installing Consul on Kubernetes.

Example Commands

The following example command reads the Helm configuration in the myNS namespace.

  1. $ consul-k8s config read -namespace=myNS
  1. global:
  2. cloud:
  3. clientId:
  4. secretKey: client-id
  5. secretName: consul-hcp-client-id
  6. clientSecret:
  7. secretKey: client-secret
  8. secretName: consul-hcp-client-secret
  9. enabled: true
  10. resourceId:
  11. secretKey: resource-id
  12. secretName: consul-hcp-resource-id
  13. image: hashicorp/consul:1.14.7
  14. name: consul

install

The install command installs Consul on your Kubernetes cluster.

  1. $ consul-k8s install <OPTIONS>

The following options are available.

FlagDescriptionDefault
-auto-approveBoolean value that enables you to skip the installation confirmation prompt.false
-dry-runBoolean value that validates the installation and returns a summary.false
-config-fileString value that specifies the path to a file containing custom installation configurations, e.g., Consul Helm chart values file.
You can use the -config-file flag multiple times to specify multiple files.
none
-namespaceString value that specifies the namespace of the Consul installation.consul
-presetString 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.
-setString value that enables you to set a customizable value. This flag is comparable to the helm install —set flag.
You can use the -set flag multiple times to set multiple values.
Consul Helm chart values are supported.
none
-set-fileString value that specifies the name of an arbitrary config file. This flag is comparable to the helm install —set-file
flag. The contents of the file will be used to set a customizable value. You can use the -set-file flag multiple times to specify multiple files.
Consul Helm chart values are supported.
none
-set-stringString value that enables you to set a customizable string value. This flag is comparable to the helm install —set-string
flag. You can use the -set-string flag multiple times to specify multiple strings.
Consul Helm chart values are supported.
none
-timeoutSpecifies how long to wait for the installation process to complete before timing out. The value is specified with an integer and string value indicating a unit of time.
The following units are supported:
ms (milliseconds)
s (seconds)
m (minutes)
In the following example, installation will timeout after one minute:
consul-k8s install -timeout 1m
10m
-waitBoolean value that determines if Consul should wait for resources in the installation to be ready before exiting the command.true
-verbose, -vBoolean value that specifies whether to output verbose logs from the install command with the status of resources being installed.false
-help, -hPrints usage information for this option.none

See Global Options for additional commands that you can use when installing Consul on Kubernetes.

Example Commands

The following example command installs Consul in the myNS namespace according to the secure preset.

  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 flags.

  1. $ consul-k8s install -set key=value
  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-string key=value-bool

proxy

The proxy command exposes two subcommands for interacting with proxies managed by Consul in your Kubernetes Cluster.

  • proxy list: List all Pods running proxies managed by Consul.
  • proxy read: Inspect the Envoy configuration for a given Pod.
  • proxy log: Inspect and modify the Envoy logging configuration for a given Pod.

proxy list

  1. $ consul-k8s proxy list <OPTIONS>
FlagDescriptionDefault
-all-namespaces, -ABoolean List pods in all Kubernetes namespaces.false
-namespace, -nString The Kubernetes namespace to list proxies in.Current kubeconfig namespace.

Refer to the Global Options for additional options that you can use when installing Consul on Kubernetes.

This command lists proxies and their Type. Types of proxies include:

  • Sidecar: The majority of pods in the cluster are Sidecar types. They run the proxy as a sidecar to connect the pod as a service in the mesh.
  • API Gateway: These pods run a proxy to manage connections with networks outside of the Consul cluster. Read more about API gateways.
  • Ingress Gateway: These pods run a proxy to manage ingress into the Kubernetes cluster. Read more about ingress gateways.
  • Terminating Gateway: These pods run a proxy to control connections to external services. Read more about terminating gateways.
  • Mesh Gateway: These pods run a proxy to manage connections between Consul clusters connected using mesh federation. Read more about Consul Mesh Federation.

Example Commands

Display all pods in the current Kubernetes namespace that run proxies managed by Consul.

  1. $ consul-k8s proxy list
  1. Namespace: default
  2. Name Type
  3. backend-658b679b45-d5xlb Sidecar
  4. client-767ccfc8f9-6f6gx Sidecar
  5. client-767ccfc8f9-f8nsn Sidecar
  6. client-767ccfc8f9-ggrtx Sidecar
  7. frontend-676564547c-v2mfq Sidecar

Display all pods in the consul Kubernetes namespace that run proxies managed by Consul.

  1. $ consul-k8s proxy list -n consul
  1. Namespace: consul
  2. Name Type
  3. consul-ingress-gateway-6fb5544485-br6fl Ingress Gateway
  4. consul-ingress-gateway-6fb5544485-m54sp Ingress Gateway

Display all Pods across all namespaces that run proxies managed by Consul.

  1. $ consul-k8s proxy list -A
  2. Namespace: All namespaces
  3. Namespace Name Type
  4. consul consul-ingress-gateway-6fb5544485-br6fl Ingress Gateway
  5. consul consul-ingress-gateway-6fb5544485-m54sp Ingress Gateway
  6. default backend-658b679b45-d5xlb Sidecar
  7. default client-767ccfc8f9-6f6gx Sidecar
  8. default client-767ccfc8f9-f8nsn Sidecar
  9. default client-767ccfc8f9-ggrtx Sidecar
  10. default frontend-676564547c-v2mfq Sidecar

proxy read

The proxy read command allows you to inspect the configuration of Envoy proxies running on a given Pod.

  1. $ consul-k8s proxy read <PODNAME> <OPTIONS>

The command takes a required value, <PODNAME>. This should be the full name of a Kubernetes Pod. If a Pod is running more than one Envoy proxy managed by Consul, as in the Multiport configuration, configuration for all proxies in the Pod will be displayed.

The following options are available.

FlagDescriptionDefault
-namespace, -nString The namespace where the target Pod can be found.Current kubeconfig namespace.
-output, -oString Output the Envoy configuration as ‘table’, ‘json’, or ‘raw’.‘table’
-clustersBoolean Filter output to only show clusters.false
-endpointsBoolean Filter output to only show endpoints.false
-listenersBoolean Filter output to only show listeners.false
-routesBoolean Filter output to only show routes.false
-secretsBoolean Filter output to only show secrets.false
-addressString Filter clusters, endpoints, and listeners output to only those with endpoint addresses which contain the given value.“”
-fqdnString Filter cluster output to only clusters with a fully qualified domain name which contains the given value.“”
-portInt Filter endpoints output to only endpoints with the given port number.-1 which does not filter by port

Example commands

Get the configuration summary for the Envoy proxy running on the Pod backend-658b679b45-d5xlb.

  1. $ consul-k8s proxy read backend-658b679b45-d5xlb
  2. Envoy configuration for backend-658b679b45-d5xlb in namespace default:
  3. ==> Clusters (5)
  4. Name FQDN Endpoints Type Last Updated
  5. local_agent local_agent 192.168.79.187:8502 STATIC 2022-05-13T04:22:39.553Z
  6. client client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 192.168.18.110:20000, 192.168.52.101:20000, 192.168.65.131:20000 EDS 2022-08-08T12:02:07.471Z
  7. frontend frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 192.168.63.120:20000 EDS 2022-08-08T12:02:07.354Z
  8. local_app local_app 127.0.0.1:8080 STATIC 2022-05-13T04:22:39.655Z
  9. original-destination original-destination ORIGINAL_DST 2022-05-13T04:22:39.743Z
  10. ==> Endpoints (6)
  11. Address:Port Cluster Weight Status
  12. 192.168.79.187:8502 local_agent 1.00 HEALTHY
  13. 192.168.18.110:20000 client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 1.00 HEALTHY
  14. 192.168.52.101:20000 client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 1.00 HEALTHY
  15. 192.168.65.131:20000 client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 1.00 HEALTHY
  16. 192.168.63.120:20000 frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 1.00 HEALTHY
  17. 127.0.0.1:8080 local_app 1.00 HEALTHY
  18. ==> Listeners (2)
  19. Name Address:Port Direction Filter Chain Match Filters Last Updated
  20. public_listener 192.168.69.179:20000 INBOUND Any * to local_app/ 2022-08-08T12:02:22.261Z
  21. outbound_listener 127.0.0.1:15001 OUTBOUND 10.100.134.173/32, 240.0.0.3/32 to client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 2022-07-18T15:31:03.246Z
  22. 10.100.31.2/32, 240.0.0.5/32 to frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul
  23. Any to original-destination
  24. ==> Routes (1)
  25. Name Destination Cluster Last Updated
  26. public_listener local_app/ 2022-08-08T12:02:22.260Z
  27. ==> Secrets (0)
  28. Name Type Last Updated

Get the Envoy configuration summary for all clusters with a fully qualified domain name that includes "default". Display only clusters and listeners.

  1. $ consul-k8s proxy read backend-658b679b45-d5xlb -fqdn default -clusters -listeners
  2. ==> Filters applied
  3. Fully qualified domain names containing: default
  4. Envoy configuration for backend-658b679b45-d5xlb in namespace default:
  5. ==> Clusters (2)
  6. Name FQDN Endpoints Type Last Updated
  7. client client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 192.168.18.110:20000, 192.168.52.101:20000, 192.168.65.131:20000 EDS 2022-08-08T12:02:07.471Z
  8. frontend frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 192.168.63.120:20000 EDS 2022-08-08T12:02:07.354Z
  9. ==> Listeners (2)
  10. Name Address:Port Direction Filter Chain Match Filters Last Updated
  11. public_listener 192.168.69.179:20000 INBOUND Any * to local_app/ 2022-08-08T12:02:22.261Z
  12. outbound_listener 127.0.0.1:15001 OUTBOUND 10.100.134.173/32, 240.0.0.3/32 to client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul 2022-07-18T15:31:03.246Z
  13. 10.100.31.2/32, 240.0.0.5/32 to frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul
  14. Any to original-destination

Get the Envoy configuration summary in a JSON format. Note that this is not the same as the raw configuration dump from the admin API. This information is the same as what is displayed in the table output above, but in a JSON format.

  1. $ consul-k8s proxy read backend-658b679b45-d5xlb -o json
  2. {
  3. "backend-658b679b45-d5xlb": {
  4. "clusters": [
  5. {
  6. "Name": "local_agent",
  7. "FullyQualifiedDomainName": "local_agent",
  8. "Endpoints": [
  9. "192.168.79.187:8502"
  10. ],
  11. "Type": "STATIC",
  12. "LastUpdated": "2022-05-13T04:22:39.553Z"
  13. },
  14. {
  15. "Name": "client",
  16. "FullyQualifiedDomainName": "client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  17. "Endpoints": [
  18. "192.168.18.110:20000",
  19. "192.168.52.101:20000",
  20. "192.168.65.131:20000"
  21. ],
  22. "Type": "EDS",
  23. "LastUpdated": "2022-08-08T12:02:07.471Z"
  24. },
  25. {
  26. "Name": "frontend",
  27. "FullyQualifiedDomainName": "frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  28. "Endpoints": [
  29. "192.168.63.120:20000"
  30. ],
  31. "Type": "EDS",
  32. "LastUpdated": "2022-08-08T12:02:07.354Z"
  33. },
  34. {
  35. "Name": "local_app",
  36. "FullyQualifiedDomainName": "local_app",
  37. "Endpoints": [
  38. "127.0.0.1:8080"
  39. ],
  40. "Type": "STATIC",
  41. "LastUpdated": "2022-05-13T04:22:39.655Z"
  42. },
  43. {
  44. "Name": "original-destination",
  45. "FullyQualifiedDomainName": "original-destination",
  46. "Endpoints": [],
  47. "Type": "ORIGINAL_DST",
  48. "LastUpdated": "2022-05-13T04:22:39.743Z"
  49. }
  50. ],
  51. "endpoints": [
  52. {
  53. "Address": "192.168.79.187:8502",
  54. "Cluster": "local_agent",
  55. "Weight": 1,
  56. "Status": "HEALTHY"
  57. },
  58. {
  59. "Address": "192.168.18.110:20000",
  60. "Cluster": "client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  61. "Weight": 1,
  62. "Status": "HEALTHY"
  63. },
  64. {
  65. "Address": "192.168.52.101:20000",
  66. "Cluster": "client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  67. "Weight": 1,
  68. "Status": "HEALTHY"
  69. },
  70. {
  71. "Address": "192.168.65.131:20000",
  72. "Cluster": "client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  73. "Weight": 1,
  74. "Status": "HEALTHY"
  75. },
  76. {
  77. "Address": "192.168.63.120:20000",
  78. "Cluster": "frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul",
  79. "Weight": 1,
  80. "Status": "HEALTHY"
  81. },
  82. {
  83. "Address": "127.0.0.1:8080",
  84. "Cluster": "local_app",
  85. "Weight": 1,
  86. "Status": "HEALTHY"
  87. }
  88. ],
  89. "listeners": [
  90. {
  91. "Name": "public_listener",
  92. "Address": "192.168.69.179:20000",
  93. "FilterChain": [
  94. {
  95. "Filters": [
  96. "* to local_app/"
  97. ],
  98. "FilterChainMatch": "Any"
  99. }
  100. ],
  101. "Direction": "INBOUND",
  102. "LastUpdated": "2022-08-08T12:02:22.261Z"
  103. },
  104. {
  105. "Name": "outbound_listener",
  106. "Address": "127.0.0.1:15001",
  107. "FilterChain": [
  108. {
  109. "Filters": [
  110. "to client.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul"
  111. ],
  112. "FilterChainMatch": "10.100.134.173/32, 240.0.0.3/32"
  113. },
  114. {
  115. "Filters": [
  116. "to frontend.default.dc1.internal.bc3815c2-1a0f-f3ff-a2e9-20d791f08d00.consul"
  117. ],
  118. "FilterChainMatch": "10.100.31.2/32, 240.0.0.5/32"
  119. },
  120. {
  121. "Filters": [
  122. "to original-destination"
  123. ],
  124. "FilterChainMatch": "Any"
  125. }
  126. ],
  127. "Direction": "OUTBOUND",
  128. "LastUpdated": "2022-07-18T15:31:03.246Z"
  129. }
  130. ],
  131. "routes": [
  132. {
  133. "Name": "public_listener",
  134. "DestinationCluster": "local_app/",
  135. "LastUpdated": "2022-08-08T12:02:22.260Z"
  136. }
  137. ],
  138. "secrets": []
  139. }
  140. }

Get the raw Envoy configuration dump and clusters information for the Envoy proxy running on the Pod backend-658b679b45-d5xlb. The example command returns the raw configuration for each service as JSON. You can use the JQ command line tool to index into the configuration for the service you want to inspect.

Refer to the Envoy config dump documentation for more information on the structure of the config dump.

The following output is truncated for brevity.

  1. $ consul-k8s proxy read backend-658b679b45-d5xlb -o raw
  2. {
  3. "backend-658b679b45-d5xlb": {
  4. "clusters": {
  5. // [-- snip 372 lines --] output from the Envoy admin interface's /clusters endpoint.
  6. },
  7. "config_dump": {
  8. // [-- snip 1816 lines --] output from the Envoy admin interface's /config_dump?include_eds endpoint.
  9. }
  10. }

proxy log

The proxy log command allows you to inspect and modify the logging configuration of Envoy proxies running on a given Pod.

  1. $ consul-k8s proxy log <PODNAME> <OPTIONS>

The command takes a required value, <PODNAME>. This should be the full name of a Kubernetes Pod. If a Pod is running more than one Envoy proxy managed by Consul, as in the Multiport configuration, the terminal displays configuration information for all proxies in the pod.

The following options are available.

FlagDescriptionDefault
-namespace, -nString Specifies the namespace containing the target Pod.Current kubeconfig namespace.
-update-level, -uString Specifies the logger (optional) and the level to update.

Use the following format to configure the same level for loggers: -update-level <LEVEL>.

You can also specify a comma-delineated list to configure levels for specific loggers, for example: -update-level grpc:warning,http:info.

none
-reset, -rString Reset the log levels for all loggers back to the default of infoinfo

Example commands

In the following example, Consul returns the log levels for all of an Envoy proxy’s loggers in a pod with the ID server-697458b9f8-4vr29:

  1. $ consul-k8s proxy log server-697458b9f8-4vr29
  2. Envoy log configuration for server-697458b9f8-4vr29 in namespace default:
  3. ==> Log Levels for server-697458b9f8-4vr29
  4. Name Level
  5. rds info
  6. backtrace info
  7. hc info
  8. http info
  9. io info
  10. jwt info
  11. rocketmq info
  12. matcher info
  13. runtime info
  14. redis info
  15. stats info
  16. tap info
  17. alternate_protocols_cache info
  18. grpc info
  19. init info
  20. quic info
  21. thrift info
  22. wasm info
  23. aws info
  24. conn_handler info
  25. ext_proc info
  26. hystrix info
  27. tracing info
  28. dns info
  29. oauth2 info
  30. connection info
  31. health_checker info
  32. kafka info
  33. mongo info
  34. config info
  35. admin info
  36. forward_proxy info
  37. misc info
  38. websocket info
  39. dubbo info
  40. happy_eyeballs info
  41. main info
  42. client info
  43. lua info
  44. udp info
  45. cache_filter info
  46. filter info
  47. multi_connection info
  48. quic_stream info
  49. router info
  50. http2 info
  51. key_value_store info
  52. secret info
  53. testing info
  54. upstream info
  55. assert info
  56. ext_authz info
  57. rbac info
  58. decompression info
  59. envoy_bug info
  60. file info
  61. pool info

The following command updates the log levels for all loggers of an Envoy proxy to warning.

  1. $ consul-k8s proxy log server-697458b9f8-4vr29 -update-level warning
  2. Envoy log configuration for server-697458b9f8-4vr29 in namespace default:
  3. ==> Log Levels for server-697458b9f8-4vr29
  4. Name Level
  5. pool warning
  6. rbac warning
  7. tracing warning
  8. aws warning
  9. cache_filter warning
  10. decompression warning
  11. init warning
  12. assert warning
  13. client warning
  14. misc warning
  15. udp warning
  16. config warning
  17. hystrix warning
  18. key_value_store warning
  19. runtime warning
  20. admin warning
  21. dns warning
  22. jwt warning
  23. redis warning
  24. quic warning
  25. alternate_protocols_cache warning
  26. conn_handler warning
  27. ext_proc warning
  28. http warning
  29. oauth2 warning
  30. ext_authz warning
  31. http2 warning
  32. kafka warning
  33. mongo warning
  34. router warning
  35. thrift warning
  36. grpc warning
  37. matcher warning
  38. hc warning
  39. multi_connection warning
  40. wasm warning
  41. dubbo warning
  42. filter warning
  43. upstream warning
  44. backtrace warning
  45. connection warning
  46. io warning
  47. main warning
  48. happy_eyeballs warning
  49. rds warning
  50. tap warning
  51. envoy_bug warning
  52. rocketmq warning
  53. file warning
  54. forward_proxy warning
  55. stats warning
  56. health_checker warning
  57. lua warning
  58. secret warning
  59. quic_stream warning
  60. testing warning
  61. websocket warning

The following command updates the grpc log level to error, the http log level to critical, and the runtime log level to debug for pod ID server-697458b9f8-4vr29

  1. $ consul-k8s proxy log server-697458b9f8-4vr29 -update-level grpc:error,http:critical,runtime:debug
  2. Envoy log configuration for server-697458b9f8-4vr29 in namespace default:
  3. ==> Log Levels for server-697458b9f8-4vr29
  4. Name Level
  5. assert info
  6. dns info
  7. http critical
  8. pool info
  9. thrift info
  10. udp info
  11. grpc error
  12. hc info
  13. stats info
  14. wasm info
  15. alternate_protocols_cache info
  16. ext_authz info
  17. filter info
  18. http2 info
  19. key_value_store info
  20. tracing info
  21. cache_filter info
  22. quic_stream info
  23. aws info
  24. io info
  25. matcher info
  26. rbac info
  27. tap info
  28. connection info
  29. conn_handler info
  30. rocketmq info
  31. hystrix info
  32. oauth2 info
  33. redis info
  34. backtrace info
  35. file info
  36. forward_proxy info
  37. kafka info
  38. config info
  39. router info
  40. runtime debug
  41. testing info
  42. happy_eyeballs info
  43. ext_proc info
  44. init info
  45. lua info
  46. health_checker info
  47. misc info
  48. envoy_bug info
  49. jwt info
  50. main info
  51. quic info
  52. upstream info
  53. websocket info
  54. client info
  55. decompression info
  56. mongo info
  57. multi_connection info
  58. rds info
  59. secret info
  60. admin info
  61. dubbo info

The following command resets the log levels for all loggers of an Envoy proxy in pod server-697458b9f8-4vr29 to the default level of info.

  1. $ consul-k8s proxy log server-697458b9f8-4vr29 -r
  2. Envoy log configuration for server-697458b9f8-4vr29 in namespace default:
  3. ==> Log Levels for server-697458b9f8-4vr29
  4. Name Level
  5. ext_proc info
  6. secret info
  7. thrift info
  8. tracing info
  9. dns info
  10. rocketmq info
  11. happy_eyeballs info
  12. hc info
  13. io info
  14. misc info
  15. conn_handler info
  16. key_value_store info
  17. rbac info
  18. hystrix info
  19. wasm info
  20. admin info
  21. cache_filter info
  22. client info
  23. health_checker info
  24. oauth2 info
  25. runtime info
  26. testing info
  27. grpc info
  28. upstream info
  29. forward_proxy info
  30. matcher info
  31. pool info
  32. aws info
  33. decompression info
  34. jwt info
  35. tap info
  36. assert info
  37. redis info
  38. http info
  39. quic info
  40. rds info
  41. connection info
  42. envoy_bug info
  43. stats info
  44. alternate_protocols_cache info
  45. backtrace info
  46. filter info
  47. http2 info
  48. init info
  49. multi_connection info
  50. quic_stream info
  51. dubbo info
  52. ext_authz info
  53. main info
  54. udp info
  55. websocket info
  56. config info
  57. mongo info
  58. router info
  59. file info
  60. kafka info
  61. lua info

status

The status command provides an overall status summary of the Consul on Kubernetes installation. It also provides the configuration that was used to deploy Consul K8s and information about the health of Consul servers and clients. This command does not take in any flags.

  1. $ consul-k8s status

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. 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)

troubleshoot

The troubleshoot command exposes two subcommands for troubleshooting Consul service mesh and network issues from a given pod.

  • troubleshoot upstreams: List all Envoy upstreams in Consul service mesh from the given pod.
  • troubleshoot proxy: Troubleshoot Consul service mesh configuration and network issues between the given pod and the given upstream.

troubleshoot upstreams

  1. $ consul-k8s troubleshoot upstreams -pod <pod> <OPTIONS>
FlagDescriptionDefault
-namespace, -nString The Kubernetes namespace to list proxies in.Current kubeconfig namespace.

Example Commands

The following example displays all transparent proxy upstreams in Consul service mesh from the given pod.

  1. $ consul-k8s troubleshoot upstreams -pod frontend-767ccfc8f9-6f6gx
  2. ==> Upstreams (explicit upstreams only) (0)
  3. ==> Upstreams IPs (transparent proxy only) (1)
  4. [10.4.6.160 240.0.0.3] true map[backend.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul backend2.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul]
  5. If you cannot find the upstream address or cluster for a transparent proxy upstream:
  6. - Check intentions: Tproxy upstreams are configured based on intentions. Make sure you have configured intentions to allow traffic to your upstream.
  7. - To check that the right cluster is being dialed, run a DNS lookup for the upstream you are dialing. For example, run `dig backend.svc.consul` to return the IP address for the `backend` service. If the address you get from that is missing from the upstream IPs, it means that your proxy may be misconfigured.

The following example displays all explicit upstreams from the given pod in the Consul service mesh.

  1. $ consul-k8s troubleshoot upstreams -pod client-767ccfc8f9-6f6gx
  2. ==> Upstreams (explicit upstreams only) (1)
  3. server
  4. counting
  5. ==> Upstreams IPs (transparent proxy only) (0)
  6. If you cannot find the upstream address or cluster for a transparent proxy upstream:
  7. - Check intentions: Tproxy upstreams are configured based on intentions. Make sure you have configured intentions to allow traffic to your upstream.
  8. - To check that the right cluster is being dialed, run a DNS lookup for the upstream you are dialing. For example, run `dig backend.svc.consul` to return the IP address for the `backend` service. If the address you get from that is missing from the upstream IPs, it means that your proxy may be misconfigured.

troubleshoot proxy

  1. $ consul-k8s troubleshoot proxy -pod <pod> -upstream-ip <ip> <OPTIONS>
  2. $ consul-k8s troubleshoot proxy -pod <pod> -upstream-envoy-id <envoy-id> <OPTIONS>
FlagDescriptionDefault
-namespace, -nString The Kubernetes namespace to list proxies in.Current kubeconfig namespace.
-upstream-ipString The IP address of the upstream transparent proxy
-upstream-envoy-idString The Envoy identifier of the upstream

Example Commands

The following example troubleshoots the Consul service mesh configuration and network issues between the given pod and the given upstream IP.

  1. $ consul-k8s troubleshoot proxy -pod frontend-767ccfc8f9-6f6gx -upstream-ip 10.4.6.160
  2. ==> Validation
  3. certificates are valid
  4. Envoy has 0 rejected configurations
  5. Envoy has detected 0 connection failure(s)
  6. listener for upstream "backend" found
  7. route for upstream "backend" found
  8. cluster "backend.default.dc1.internal..consul" for upstream "backend" found
  9. healthy endpoints for cluster "backend.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul" for upstream "backend" found
  10. cluster "backend2.default.dc1.internal..consul" for upstream "backend" found
  11. ! no healthy endpoints for cluster "backend2.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul" for upstream "backend" found

The following example troubleshoots the Consul service mesh configuration and network issues between the given pod and the given upstream.

  1. $ consul-k8s troubleshoot proxy -pod frontend-767ccfc8f9-6f6gx -upstream-envoy-id db
  2. ==> Validation
  3. certificates are valid
  4. Envoy has 0 rejected configurations
  5. Envoy has detected 0 connection failure(s)
  6. ! no listener for upstream "db" found
  7. ! no route for upstream "backend" found
  8. ! no cluster "db.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul" for upstream "db" found
  9. ! no healthy endpoints for cluster "db.default.dc1.internal.e08fa6d6-e91e-dfe0-f6e1-ba097a828e31.consul" for upstream "db" found

uninstall

The uninstall command removes Consul from Kubernetes.

  1. $ consul-k8s uninstall <OPTIONS>

The following options are available.

FlagDescriptionDefault
-auto-approveBoolean value that enables you to skip the removal confirmation prompt.false
-nameString value for the name of the installation to remove.none
-namespaceString value that specifies the namespace of the Consul installation to remove.consul
-timeoutSpecifies how long to wait for the removal process to complete before timing out. The value is specified with an integer and string value indicating a unit of time.
The following units are supported:
ms (milliseconds)
s (seconds)
m (minutes)
h (hours)
In the following example, removal will timeout after one minute:
consul-k8s uninstall -timeout 1m
10m
-wipe-dataBoolean value that deletes PVCs and secrets associated with the Consul installation during installation.
Data will be removed without a verification prompt if the -auto-approve flag is set to true.
false
Instructions for removing data will be printed to the console.
—helpPrints usage information for this option.none

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

upgrade

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 Upgrade the Consul K8s CLI

  1. $ consul-k8s upgrade

The following options are available.

FlagDescriptionDefault
-auto-approveBoolean value that enables you to skip the upgrade confirmation prompt.false
-dry-runBoolean value that allows you to run pre-upgrade checks and returns a summary of the upgrade.false
-config-fileString value that specifies the path to a file containing custom upgrade configurations, e.g., Consul Helm chart values file.
You can use the -config-file flag multiple times to specify multiple files.
none
-namespaceString value that specifies the namespace of the Consul installation.consul
-presetString value that upgrades Consul based on a preset configuration.Configuration of the Consul Helm chart.
-setString value that enables you to set a customizable value. This flag is comparable to the helm upgrade —set flag.
You can use the -set flag multiple times to set multiple values.
Consul Helm chart values are supported.
none
-set-fileString value that specifies the name of an arbitrary config file. This flag is comparable to the helm upgrade —set-file
flag. The contents of the file will be used to set a customizable value. You can use the -set-file flag multiple times to specify multiple files.
Consul Helm chart values are supported.
none
-set-stringString value that enables you to set a customizable string value. This flag is comparable to the helm upgrade —set-string
flag. You can use the -set-string flag multiple times to specify multiple strings.
Consul Helm chart values are supported.
none
-timeoutSpecifies how long to wait for the upgrade process to complete before timing out. The value is specified with an integer and string value indicating a unit of time.
The following units are supported:
ms (milliseconds)
s (seconds)
m (minutes)
In the following example, the upgrade will timeout after one minute:
consul-k8s upgrade -timeout 1m
10m
-waitBoolean value that determines if Consul should wait for resources in the upgrade to be ready before exiting the command.true
-verbose, -vBoolean value that specifies whether to output verbose logs from the upgrade command with the status of resources being upgraded.false
—helpPrints usage information for this option.none

See Global Options for additional commands that you can use when installing Consul on Kubernetes.

version

The version command prints the Consul on Kubernetes version. This command does not take any options.

  1. $ consul-k8s version

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

  1. $ consul-k8s --version

Global Options

The following global options are available.

FlagDescriptionDefault
-contextString value that sets the Kubernetes context to use for Consul K8s CLI operations.none
-kubeconfig, -cString value that specifies the path to the kubeconfig file.
none