kubernetes - k8s/gke/gcr - scope an image to a namespace -
i have gke cluster number of different namespaces. able in effect namespace images same way other resources namespaced. is, pods in different namespaces able reference image using same name them different images depending on namespace in. 1 way achieve (if supported) might substitute name of namespace image name in yml, eg:
containers: - image: eu.gcr.io/myproject/$(namespace)-myimage name: myimage then push eu.gcr.io/myproject/mynamespace-myimage make image available namespace mynamespace.
is there tidy way achieve kind of thing. if not, , since i've been unable find else asking similar questions, there way in bad thing want do?
i don't think possible. kubernetes supports expansion on fields command , args. lets use substitutions variable set in container's env field, can come configmap/secret. example: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#use-environment-variables-to-define-arguments
however don't think variable expansion works image field. :(
what you're trying not seem great idea: having different images across multiple environments defeats purpose of having test/staging environments.
instead should should use same image test on platforms, changing env vars, configmaps etc.
Comments
Post a Comment