How to run an arbitrary script on a pod after Helm Chart installed it?

4/17/2020

Use case: I am forced to use an unflexible chart, which doesnt externalize some important properties to Values.yml.

So I want to touch those manually after the pod is created.

I dont want to make the chart public here , but here as an example:

Imagine there is a kubernetes yaml which creates a simple pod from a modified postgresql image.

containers:
      - name: my-psql
        image: modded-postgres
        env:
           - name: POSTGRES_PASSWORD
             value: postgres
        ports:
        - containerPort: 5432

The modded-postgres image differs from the official one in a way ,that there is no entrypoint , only cmd.

What should I do to init the db with some init.sql?

I can't touch neither the image nor the the yaml. The yaml resides inside a chart which I have to use as a subchart.

What are my possibilities? Can I run some helm script after pod creation? Or what about to launch other pod which will connect to this crappy postgres pod and make the db from the there?

-- beatrice
docker
kubernetes-helm

0 Answers