How to set metadata.name from a dynamic variable when creating for example a namespace we don’t know the name in advance but need to “kustomize” like adding commonLabels etc to it?
If I understand you correctly there are few options depending on your needs:
Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.
You can use a
PodPreset
object to inject information like secrets, volume mounts, and environment variables etc into pods at creation time.
ConfigMaps
allow you to decouple configuration artifacts from image content to keep containerized applications portable.
kubectl replace -f FILE
command. Or use kubectl edit DEPLOYMENT
command in order to automatically applly the changes.Please let me know if that helped.