0
votes

I'm trying to use Kubernetes API from inside a pod. Going to list/watch pods and custom defined resources.

Construct url as "https://KUBERNETES_SERVICE_HOST:KUBERNETES_SERVICE_PORT_HTTPS" Authorization header = "Bearer /var/run/secrets/kubernetes.io/serviceaccount/token" CaCert = /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

When running inside minikube, the request fails with "Error: connect ETIMEDOUT 10.96.0.1:443" Same code running in GCP fails with: "Error: unable to verify the first certificate"

1
stackoverflow.com/questions/30690186/… This link has a few solutions you can try.Colwin
While the question in those posts have similar title, the actual problems are different. In case of minikube I'm not able to connect to the api server. when running in GCP there are some problems with the certificate.rubenhak
I've also tried this tutorial, but am getting the same behaviour. medium.com/@pczarkowski/…rubenhak

1 Answers

0
votes

If you are using curl, you can skip certificate checks with the -k flag.

Try

curl -k  https://10.96.0.1:443/api/v1/namespaces -H "Authorization: Bearer <content of /var/run/secrets/kubernetes.io/serviceaccount/token here>"