Is there a way for stopping the GKE clusters when not in use and restart them when required

0 votes
I have created a cluster for R&D purpose using n1-standard-8 machines. It is used in day time, Is there any way to stop the cluster during night time or on weekends ?
Nov 6, 2019 in GCP by anonymous
• 19,610 points

1 answer to this question.

0 votes

You can simply set the replicas to 0 in the yaml and it'll effectively turn off the cluster. And, it'd then be a fairly simple matter of scaling it back up the same way. 

So, if you wanted to, you could set up a job to run "kubectl apply -f your-deployment-day.yaml" during the day to start the cluster and kubectl apply -f your-development-night.yaml" to stop it during evening and weekends.

answered Nov 6, 2019 by Sirajul
• 59,230 points
Hi Sirajul,

The deployment would be applicable for kuberentes objects only(pods,svc,rs), however the question was to stop the nodes/cluster in case of non-use ?

You can temporarily scale the number of nodes in your cluster down to zero by running:

gcloud container clusters resize $CLUSTER_NAME --num-nodes=0

Then scale it back up later by running that with a non-zero value for the size flag.

Related Questions In GCP

+1 vote
1 answer
0 votes
1 answer

Can I create a load balancer with path based routing in GKE?

Yes, it's possible. Note that you simply will use the internal Load balancing (ILB) for ...READ MORE

answered Oct 10, 2019 in GCP by Sirajul
• 59,230 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP