I’ve been having a lot of trouble getting my GKE cluster to autoscale without breaking down.
I’m testing auto-scaling by
starting the cluster with no user-placeholders
changing the config.yaml to these lines:
userPlaceholder:
enabled: true
replicas: 110
Doing a helm upgrade with this change in configuration.
I see the cluster scaling up, and the 110 user-placeholder pods arriving, as seen from kubectl get pod, but at around the point they have all gone from Pending to Running, I get this from kubectl get pod:
The connection to the server 35.197.204.116 was refused - did you specify the right host or port?
The connection to the server 35.197.204.116 was refused - did you specify the right host or port?
At that point the output of gcloud container cluster list is:
It returned to status RUNNING after about 5 minutes, at which point I could run kubectl get pod again, and I found that one of my user-scheduler pods had restarted.
--previous log from that pod has this before a long Go traceback:
In my curent experiments (details below), spinning up 250 user-placeholders, and therefore 32 nodes, the cluster is locked in “RECONCILING” state. With a regional (rather than zonal) cluster, I can still communicate with the cluster, but 95 of the 250 placeholders meanwhile got jammed in “Pending” state, and stayed there for 14 minutes. The cluster meanwhile remains in “RECONCILING” state.
Current experiments were to move from a zonal cluster, to a regional cluster (this costs more, because I get one zonal cluster for free), and increasing the default-pool cluster machine from n1-standard-2 (7.5GB memory) to n1-highmem-4 (26GB memory).
Are your quotas doing ok? Sometimes the cluster tries to scale up, but hits a quota limit and fails. There’s a gcloud container operations list command that might help.
I certainly did have problems with my quotas in the past - but I have just re-replicated the problem just now, with no quota issues visible via the Google quotas page for my project.
Thanks for the pointer to the gcloud command.
Replicating now, I get this sequence from gcloud container operations list when I initialize the cluster without placeholders:
gcloud container operations describe <operation-id> for the REPAIR_CLUSTER operation doesn’t give much useful information.
The helm upgrade fails with messages like:
Error: UPGRADE FAILED: an error occurred while finding last successful release. original upgrade error: Get "https://35.242.156.98/api/v1/namespaces/jhub-testing/persistentvolumeclaims/hub-db-dir": dial tcp 35.242.156.98:443: connect: connection refused: Kubernetes cluster unreachable: Get "https://35.242.156.98/version?timeout=32s": dial tcp 35.242.156.98:443: connect: connection refused
I think this is just a function of the cluster becoming unresponsive. The message from the previous failure, with the cluster having the same configuration, an hour or so ago, was:
Error: UPGRADE FAILED: an error occurred while finding last successful release. original upgrade error: Get "https://35.246.100.151/apis/apps/v1/namespaces/jhub-testing/replicasets?labelSelector=app%3Djupyterhub%2Ccomponent%3Dproxy%2Crelease%3Djhub-testing": dial tcp 35.246.100.151:443: connect: connection refused: Kubernetes cluster unreachable: Get "https://35.246.100.151/version?timeout=32s": dial tcp 35.246.100.151:443: connect: connection refused
Changing the cluster from zonal to regional allows the upgrade to succeed without error. The cluster still goes into RECONCILING state, but it remains responsive, and the pods all come up.
Do you think having a GKE regional cluster is a requirement for autoscaling? Or is there a way to mitigate the issue for zonal clusters?
Not sure about regional vs zonal. For mybinder.org we’ve been using both and in neither case seen a problem. However the maximum number of nodes in the cluster is rarely (if ever) over 15.
Is there a magic number of pods/new nodes where it works? Say if you only add 50 pods instead of 250.
Thanks again for the reply. For my setup, 250 pods is about 21 nodes. I suppose too that I may have larger images than for a classic mybinder setup - my images have a “virtual size” on eu.gcr.io of 1.1GB. I haven’t experimented with fewer nodes yet - I’ll try to do that over the next few days.