Assume I am running a Javascript server in a Pod in Kubernetes. How can I get the name of that pod or its ID?
Similarly, if I am running a Python server in namespace A, how can I get the names resp. other IDs of all pods in namespace B?
Assume I am running a Javascript server in a Pod in Kubernetes. How can I get the name of that pod or its ID?
Similarly, if I am running a Python server in namespace A, how can I get the names resp. other IDs of all pods in namespace B?
You can get the name of the pod as seen inside the Kubernetes Cluster by checking the HOSTNAME
variable inside the pod.
Ref: https://kubernetes.io/docs/concepts/containers/container-environment/
For your second question, you can always run kubectl inside a container running in the cluster. Check this question: Run kubectl inside a cluster