I am trying to shutdown kubernet clusters. Is there any method to shutdown clusters without deleting it, We want to start the same cluster after some time.
As you are using GCP, you can change numbers of Nodes
to 0. You can do it with many clusters, however please keep in mind that if you are using some special features (Network Load Balancig, Storage) you might be still charged (Cluster is still running but without any nodes). It's good to check billing after 2 days if you did not forget to turn off some features.
To resize number of the Nodes in Cluster:
Via command
gcloud container clusters resize [CLUSTER_NAME] --node-pool [POOL_NAME] \
--num-nodes [NUM_NODES]
It's described in GCP documentation
Via GCP (browser)
Later, when you will want to resize nodes you have to do the same steps.
After you will resize nodes to 0 you will be able to Connect to the cluster via Cloud Shell. All pods will be on pending
state.
$ kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default pod/php-apache-84cc7f889b-q8x52 0/1 Pending 0 6d18h
kube-system pod/event-exporter-v0.2.4-5f88c66fb7-mkfsg 0/2 Pending 0 6d18h
kube-system pod/fluentd-gcp-scaler-59b7b75cd7-fs7ms 0/1 Pending 0 6d18h
kube-system pod/heapster-v1.6.0-beta.1-65fc664955-qq52j 0/3 Pending 0 6d18h
kube-system pod/kube-dns-6987857fdb-mf6b6 0/4 Pending 0 6d18h
kube-system pod/kube-dns-6987857fdb-qlk9m 0/4 Pending 0 6d18h
kube-system pod/kube-dns-autoscaler-bb58c6784-g2sr4 0/1 Pending 0 6d18h
kube-system pod/l7-default-backend-fd59995cd-fscg4 0/1 Pending 0 6d18h
kube-system pod/metrics-server-v0.3.1-57c75779f-59g8s 0/2 Pending 0 6d18h
Hope it help.
In your case, if you are using GKE, just edit cluster and resize it to 0.
Yes, you can do that. Follow the below steps