1

Is there an easy way to get the gcloud container clusters create ... command details for an existing cluster? (... Command that can be used to create the exact same cluster)

Someone from my team created a cluster on GKE through the UI with specific region and machine type details, and a few other customizations I can't remember. I'll be deleting the cluster, as it was for a test. We may need to recreate it and for this, instead of running through the UI, I was hoping to document the gcloud command that can be used to create the same cluster.

I couldn't find anything on the GCP UI to help with this. We can through the docs (https://cloud.google.com/kubernetes-engine/docs/how-to/creating-a-cluster) construct the cmd that might build the same cluster, but wanted to check if there was a better way.

Prashant
  • 1,014
  • 11
  • 28

2 Answers2

5

You can create your cluster on the GUI and use the button on the bottom to generate the HTTP Rest command or the Gcloud command line. You can find this on several pages in the GUI.

GKE create cluster page

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Nice answer, I forgot about the GUI option to show the command line. – John Hanley Sep 15 '19 at 01:30
  • Ahh .. I missed that link. Thanks for the answer! This solves my issue, hence accepting the answer. Out of curiosity: Is there a similar link for a running cluster (after you've created the cluster in UI and moved onto the next screen)? I tried looking for the same link on different pages for a running cluster, but didn't see such link. – Prashant Sep 15 '19 at 04:13
  • Sadly, it doesn't exist the same option for existing resource (GKE, VM, Network,...). However, an [open source project](https://github.com/GoogleCloudPlatform/terraformer) exists but it is focus on Terraform reverse engineering. But maybe it could help you. – guillaume blaquiere Sep 16 '19 at 11:23
1

I recently was trying to get the gcloud command that can be used to recreate an existing cluster

I found a way to get the gcloud command with the parameters by going to your GKE-->create Cluster-->Clone an existing Cluster-->choose your Cluster and at the bottom you will have the Rest/command-line option.