We are using GCE with k8s, where we are deploying pods on GCE servers, and service accounts are linked with server that the pod is deployed on, and not directly with the pod itself.
The issue was that in k8s yaml file, used to deploy the pod, we were not setting hostNetwork
. After setting hostNetwork
to true
the metadata request returned result successfully.
Before this setting, I guess the pod will run in it's own network instead of using the server's network. More info: What is hostNetwork in Kubernetes?