Accessing the Kubernetes API from a Pod

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: Google Managed
Cloud being used: Google Kubernetes Engine
Installation method:
Host OS:
CNI and version:
CRI and version:


I am trying to access to Kubernetes API from a Pod using Java Client library. I have followed in cluster config example from below URL:

I am able to run it successfully locally but when I deploy it in GCP Kubernetes, and trying to invoke the service from within a pod, it is not working and giving below error:
org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver [http-nio-8080-exec-1] Resolved [java.nio.file.NoSuchFileException: /var/run/secrets/

I tried to find locate the certificate in ‘/var/run/secrets/’ path within pod, but it’s not available and that is why I am getting this error.

Could you please help to understand what is wrong with that.