0

I would like to define the yaml for a particular container in one file, then pull that container config into a deployment config when the depyment is built. Is it possible to do this, since a lone container is not a Kubernetes resource?

EMC
  • 1,560
  • 2
  • 17
  • 31

1 Answers1

0

Currently, it is not possible.

  • Patches won't work since the path of the podTemplate is not always the same across all workload resource types.
  • Variables don't support whole objects at the moment (I believe there was some talk about it on github), but strings only.
  • On some versions of k8s you could use something called a PodPreset, but it doesn't seem to be supported anymore.

The best you can do to avoid discrepancies between your podTemplates across all your resources would be to isolate the parts that are similar and/or error prone and use specific transformers/generators. For example use the images transformer to ensure that all your pods use the same image. Use a ConfigMap generator and envFrom to keep all the environment variables are the same.

ITChap
  • 4,057
  • 1
  • 21
  • 46