Hi Mayur,
Now I have created new private cluster. I tried 2 scenarios -
Scenario - 1.
Executing kubectl commands from VM in same project within same network.
I added VM's internal IP in master authorized network.
I connected to cluster -
gcloud container clusters get-credentials <cluster-name> --zone us-central1-a --project <project-name>
kubectl get endpoints kubernetes
NAME ENDPOINTS AGE
kubernetes
172.16.0.3:443 1d
When I try kubectl get services - it gives error as
Unable to connect to the server: x509: certificate is valid for 35.224.109.130, 10.118.16.1, 172.16.0.2, not 172.16.0.3I changed context again as
Then it worked.
Scenario - 2
Executing kubectl commands from VM in different project same network (VPN Peered network)
I added VM's internal IP in master authorized network.
I connected to cluster -
gcloud container clusters get-credentials <cluster-name> --zone us-central1-a --project <project-name>
kubectl get services - I get below error.
Unable to connect to the server: x509: certificate signed by unknown authority
My use case is scenario -2 where I am trying to access private cluster master from CICD project.
Any help is appreciated.
Thanks,
Vinita