Skip to content

Unable to connect to the server: x509: certificate signed by unknown authority – kubectl error when connecting to gcloud pods. How to fix?

When you are using your kubectl for the first time you would face this error – Unable to connect to the server: x509: certificate signed by unknown authority. To fix this you need to fetching cluster endpoint and auth data from your GCP account and create a kubeconfig entry in your local system.

Just run..

gcloud container clusters get-credentials <cluster-name> --region <region-id> --project <project-id>

Example

gcloud container clusters get-credentials poopcode-dev-cluster --region us-central1 --project poopcode-dev 
Advertisements

Output

Fetching cluster endpoint and auth data.
kubeconfig entry generated for poopcode-dev-cluster
See also  FATA Version of Docker Compose is not supported. Please use version 1, 2 or 3 - Kubernetes Error - How to fix?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.