How to deploy the Consul client on K8s with custom config.yaml?

3/5/2022

I am trying to deploy the Consul client on a k8s cluster ( the Consul server is on a docker swarm cluster). I want to use a config.yaml (mentioned in https://www.consul.io/docs/k8s/installation/deployment-configurations/servers-outside-kubernetes) to set up the configuration. I found a Helm Chart Configuration page (https://www.consul.io/docs/k8s/helm#client) and a Configuration page (https://www.consul.io/docs/agent/options#config_key_reference). What is the difference between them? It seems that I need to refer to the Helm Chart Configuration page since I am working on the k8s. However, on the Helm Chart Configuration page, I can not find how to set up something like node_name, data_dir, client_addr, bind_addr, advertise_addr. Besides, I also need to set verify_incoming, encrypt, verify_outgoing, verify_server_hostname. For ca_file, cert_file, and key_file, I assume that cert_file is for caCert (in Helm Chart Configuration), key_file is for caKey, and I am not sure what the ca_file stand for.

k8s version: Server Version:v1.22.4 There ate four servers in the cluster.

Any help would be appreciated. Thanks

-- Erika
consul
kubernetes
linux
microservices

1 Answer

3/7/2022

I can not find how to set up something like node_name, data_dir, client_addr, bind_addr, advertise_addr. Besides, I also need to set verify_incoming, encrypt, verify_outgoing, verify_server_hostname. For ca_file, cert_file, and key_file, I assume that cert_file is for caCert

Most of these parameters are specified by the Helm chart when deploying the Consul client or server pods. Is there a particular reason that you need to override these particular settings?

With that said, you can use server.extraConfig and client.extraConfig to provide additional configuration parameters to the server and client agents. Normally you would only specify parameters that are not already specified by deployments created by the Helm chart.

-- Blake Covarrubias
Source: StackOverflow