Which template in the hashicorp/consul helm chart generates the consul-connect-inject-init container in service pods

I need to know which template in the hashicorp/consul helm chart produces the init container that gets injected into my workload pods.

In TKGi kubernetes (vmware) I am looking to change the FQDN that envoy init container uses to send registration to the consul client. It appears that value is an env variable embedded in the docker image of the init container.

Examining the helm chart, I cannot see which template produces and injects that container.

This from my workload pod:
status:
initContainerStatuses:

  • containerID: docker://9303bec1ad9820f83390bb14b0ae37fcc1e3878ab175521f52d9bfcf77fdd0da
    image: consul:1.9.0-beta1
    imageID: docker-pullable://consul@sha256:9b51627ddc586d25a45bc1d9aff393e39e23515e5fb8d35925cb36869fca03a6
    lastState: {}
    name: consul-connect-inject-init
    ready: true
    restartCount: 0
    state:
    terminated:
    containerID: docker://9303bec1ad9820f83390bb14b0ae37fcc1e3878ab175521f52d9bfcf77fdd0da
    exitCode: 0
    finishedAt: ā€œ2020-12-11T14:11:17Zā€
    reason: Completed
    startedAt: ā€œ2020-12-11T14:11:12Zā€

Hi @drfooser -
Thanks for asking this question.

The envoy sidecar is actually injected by the mutating webhook in consul-k8s not via the helm chart, you can find it injected at this point in the connect inject webhook here :
https://github.com/hashicorp/consul-k8s/blob/e1484f67fd5ae4576bdc00e1f73627a36067970f/connect-inject/handler.go#L343

If you wanted to make changes to it you could build a custom consul-k8s image with these changes, and to make it configurable would require changes to both consul-k8s and consul-helm.

1 Like