Erlang cluster on Kubernetes: Basic init container

22 Dec 2022 09:56 erlang kubernetes

As explained here, I’m going to use an init container to issue the pod certificates.

This seems like it would be less invasive and more generic than making changes to the main container. Consider the situation where you wanted to use that container with something other than cert-manager (Amazon KMS, for example). By separating that concern into an init container, we make it easier to change our minds later.

This post talks about adding a simple “Hello World!” init container to the pod. I’ll add the certificate stuff in a later post.

The Dockerfile is as follows:


WORKDIR /erlclu-init

ENTRYPOINT ["/erlclu-init/"]

The script is as follows:


echo "Hello from $(hostname)"

We add it to the deployment as follows:

    - name: erlclu-init
      imagePullPolicy: Always

The Makefile is as follows:

all: build-init-image push-init-image

        podman build -f Dockerfile.init -t erlclu-init

        podman push erlclu-init $(DOCKER_REGISTRY)/erlclu-init:$(RELEASE_VSN)

Note: it expects to inherit the environment variables from the top-level Makefile.