One way I could think of is to set an environment which value is the namespace of the Pod when defining the Pod.
Getting the namespace dynamically without requiring changes for Pod will be
better because it lessens the burden of constructing a Pod.
So is there a way to get current namespace in a Pod?
Try the file:
/var/run/secrets/kubernetes.io/serviceaccount/namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With