Unable to install helm chart on private Google Kubernetes Engine (timeout error)

Viewed 386

I have created a private cluster in gke with the follwoing

gcloud container clusters create private-cluster-0 \
--create-subnetwork name=my-subnet-0 \
--enable-master-authorized-networks \
--enable-ip-alias \
--enable-private-nodes \
--enable-private-endpoint \
--master-ipv4-cidr 172.16.0.32/28 \
--zone us-central1-a

Then I did

gcloud container clusters get-credentials --zone us-central1-a private-cluster-0

I was trying to install a helm chart from my local machine but I got the following error:

Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "https://172.16.0.34/version?timeout=32s": dial tcp 172.16.0.34:443: i/o timeout

Can anyone please tell me how to resolve this error. How to deploy an helm chart from a local machine to a private cluster in gke?

2 Answers

You created a private cluster and trying to install helm from local machine.
This won't work because 172.16.0.0/12 range is non-routable, your PC is looking for the cluster in your own LAN.

You can find information on accessing private GKE clusters on google docs.
There are also more general tutorials on installing helm on GKE from google and medium.

First you need basic connectivity to access your private cluster. For example, SSH to a VM on a subnet that master-ipv4-cidr allows.

I had this basic connectivity but was still unable to install a helm chart as the install couldn't access services within the cluster.

I could only see this issue after adding verbosity to helm install and logging the output.

helm install -v10 my-chart  >log.txt 2>&1

With the get-credentials command

gcloud container clusters get-credentials --zone us-central1-a private-cluster-0

Try adding the argument --internal-ip

This controls whether to use the internal IP address of the cluster endpoint. It made the difference for me.

Related