[Helm Chart] How to set config-dir in values.yaml?

Sorry if this is a stupid question to ask, but I can’t setting ‘extraVolumes’ correctly follow by help. :sob:

My Consul.d path is /home/data/consul.d/ in host.
I try to edit the values.yaml and use ‘helm upgrade’

server:
  extraVolumes:
    - type: configMap
      name: consul.d
      load: true

then I get consul-xxx failed.

$ kubectl logs consul-zjqs9 -n consul
==> Starting Consul agent...
           Version: '1.10.4'
           Node ID: 'adaed766-5a29-4a71-aa08-d9df967b5a2f'
         Node name: 'chiyt-node'
        Datacenter: 'dc1' (Segment: '')
            Server: false (Bootstrap: false)
       Client Addr: [0.0.0.0] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)
      Cluster Addr: 10.244.0.83 (LAN: 8301, WAN: 8302)
           Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false, Auto-Encrypt-TLS: false

==> Log data will now stream in as it occurs:

2022-01-05T10:37:17.950Z [INFO]  agent.client.serf.lan: serf: EventMemberJoin: chiyt-node 10.244.0.83
2022-01-05T10:37:17.950Z [INFO]  agent.router: Initializing LAN area manager
2022-01-05T10:37:17.951Z [INFO]  agent: Started DNS server: address=0.0.0.0:8600 network=tcp
2022-01-05T10:37:17.951Z [INFO]  agent: Started DNS server: address=0.0.0.0:8600 network=udp
2022-01-05T10:37:17.951Z [INFO]  agent: Starting server: address=[::]:8500 network=tcp protocol=http
2022-01-05T10:37:17.951Z [WARN]  agent: DEPRECATED Backwards compatibility with pre-1.9 metrics enabled. These metrics will be removed in a future version of Consul. Set `telemetry { disable_compat_1.9 = true }` to disable them.
2022-01-05T10:37:17.951Z [INFO]  agent: Started gRPC server: address=[::]:8502 network=tcp
2022-01-05T10:37:17.951Z [INFO]  agent: started state syncer
2022-01-05T10:37:17.951Z [INFO]  agent: Consul agent running!
2022-01-05T10:37:17.951Z [INFO]  agent: Retry join is supported for the following discovery methods: cluster=LAN discovery_methods="aliyun aws azure digitalocean gce k8s linode mdns os packet scaleway softlayer tencentcloud triton vsphere"
2022-01-05T10:37:17.951Z [INFO]  agent: Joining cluster...: cluster=LAN
2022-01-05T10:37:17.951Z [INFO]  agent: (LAN) joining: lan_addresses=[consul-server-0.consul-server.consul.svc:8301]
2022-01-05T10:37:17.951Z [WARN]  agent.router.manager: No servers available
2022-01-05T10:37:17.951Z [ERROR] agent.anti_entropy: failed to sync remote state: error="No known Consul servers"
2022-01-05T10:37:18.048Z [WARN]  agent.client.memberlist.lan: memberlist: Failed to resolve consul-server-0.consul-server.consul.svc:8301: lookup consul-server-0.consul-server.consul.svc on 10.96.0.10:53: no such host
2022-01-05T10:37:18.048Z [WARN]  agent: (LAN) couldn't join: number_of_nodes=0 error="1 error occurred:
        * Failed to resolve consul-server-0.consul-server.consul.svc:8301: lookup consul-server-0.consul-server.consul.svc on 10.96.0.10:53: no such host

"
2022-01-05T10:37:18.048Z [WARN]  agent: Join cluster failed, will retry: cluster=LAN retry_interval=30s error=<nil>
2022-01-05T10:37:18.053Z [WARN]  agent.router.manager: No servers available
2022-01-05T10:37:18.053Z [ERROR] agent.http: Request error: method=GET url=/v1/status/leader from=127.0.0.1:34606 error="No known Consul servers"
2022-01-05T10:37:24.867Z [WARN]  agent.router.manager: No servers available
2022-01-05T10:37:24.867Z [ERROR] agent.http: Request error: method=GET url=/v1/status/leader from=127.0.0.1:34726 error="No known Consul servers"
2022-01-05T10:37:34.872Z [WARN]  agent.router.manager: No servers available
2022-01-05T10:37:34.872Z [ERROR] agent.http: Request error: method=GET url=/v1/status/leader from=127.0.0.1:34838 error="No known Consul servers"
2022-01-05T10:37:38.239Z [WARN]  agent.router.manager: No servers available
2022-01-05T10:37:38.239Z [ERROR] agent.anti_entropy: failed to sync remote state: error="No known Consul servers"
2022-01-05T10:37:38.434Z [INFO]  agent: Newer Consul version available: new_version=1.11.0 current_version=1.10.4

How do I give the config path in helm chart?
Thanks very much.

or…
should I call API ‘/agent/service/register’ to register my services instead of setting config-dir when I installed consul by Helm Chart? :sweat_smile:

This error indicates that the DNS server is unable to resolve the destination hostname. Can you verify the K8s cluster’s DNS server is functioning properly? Is that hostname resolvable from other pods in the cluster?

1 Like

Hey @chiyt27

These look like they could be temporary errors. Because you’re adding a config map for servers, that will cause servers to be upgraded which will trigger all pods to be recreated in order and re-elect a new leader. It should eventually recover though and those errors should stop.

If you are trying to register services by passing a config map, then yeah I’d say adding it to servers is probably not the best way. First, you probably want those services to be registered with clients instead of servers. Second, you might want to consider Kubernetes sync-catalog which syncs kubernetes services to consul (Service Sync - Kubernetes | Consul by HashiCorp). Depending on your use case, making an API call might be a better choice. It’s a bit hard to say for sure though without knowing what you’re trying to do.

1 Like