Using Helm Chart and Kubernetes, pass a file to the container during postStart

1/13/2020
  • I'm using Helm Chart, Kubernetes and containers.
  • I need to pass a file to the container during postStart.
  • The file will be used in the postStart script.
  • The file should change from one deployment to another and should be part of the Helm Chart values.

Is the above scenario supported? Any suggestions or examples of how to implement it?

-- user1015767
charts
configuration
initialization
kubernetes
kubernetes-helm

1 Answer

1/14/2020

Follow the below steps

  1. Create a ConfigMap object using the file/script that you want to use in postStart event
  2. Mount the ConfigMap as volume inside the pod
  3. You should be able to access the file/script inside pod/container.
-- P Ekambaram
Source: StackOverflow