0

I have a container type that I will need to intermittently add and delete from my cluster, but each different container instance will need a unique configuration in the form of environment variables.

What is the best way to structure this with Kubernetes? Should I have a separate workload for each container? Should I have one common workload and update the pod with new containers as needed?

The containers are isolated applications that don't have anything to do with their siblings.

David Maze
  • 130,717
  • 29
  • 175
  • 215
Josh
  • 246
  • 1
  • 15

2 Answers2

1

If you want to do this you can use the jobs in kubernetes, if there is no use case of PVC or PV

For each different type create a new job with the different type of environment variables.

I have a container type that I will need to intermittently add and delete from my cluster, but each different container instance will need a unique configuration in the form of environment variables.

configure multiple jobs or deployment in which you can give different options of environment variables.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
1

I do it by

  • Having a common deployment yaml. You should mount configmaps as environment variables
  • Packaging with Helm
  • Deploying with different values.yaml for each instance.

As Harsh stated, you can also use Jobs pattern but I prefer having single file & many values files instead of different jobs definitions.. Because if a key changes, you will need to update all job definitions..

efdestegul
  • 617
  • 3
  • 6