Kubernetes create secret and change default service account upon namespace creation

3/12/2019

For reasons (namespaces are created every day) upon namespace creation I would need to do the following two actions:

  • Add a gcr-json-key secret
  • Add imagePullSecrets to the default ServiceAccount

Is there an automated way to do this in Kubernetes? Is there a template for the default Service Account created that I can change? (I am using Kubernetes 1.11.5 (AWS EKS))

Right now I don't have a very good way to deal with this problem...

-- Sartigan
eks
kubernetes

1 Answer

4/15/2019

As @Jason Stanley suggested:

How are the namespaces created ? If you're using Helm, you could very easily automate the above 2 tasks for every release. Every new release would create a new namespace (you get to configure that) and every release also creates the required secret and ServiceAccount.

-- MWZ
Source: StackOverflow