<p>I would like to programmatically create GKE clusters (and resize them etc.). To do so, I could use the gscloud commands, but I found this java library that seems to imply that one can create/resize/delete clusters all from within java:
<a href="https://developers.google.com/api-client-library/java/apis/container/v1" rel="nofollow noreferrer">https://developers.google.com/api-client-library/java/apis/container/v1</a> library
(Note: This is a DIFFERENT library from the Java libraries for Kubernetes, which is well documented. The above link is for creating the INITIAL cluster, not starting up / shutting down pods etc.)</p>

<p>However, I couldn't find any examples/sample code on how to do some basic commands, eg</p>

<p>a) get list of clusters and see if a cluster of a particular name is runing
b) start up cluster of a particular name in a certain region with a certain number of nodes of a certain instance type
c) wait until the cluster has fully started up from (b)
d) etc.</p>

<p>Any one have any examples of using the java library to accomplish this?</p>

<p>Also, is there a "generic" java library for any Kubernetes cluster managerment (not just the Google GKE one? I couldn't find any. Again, there are libraries for pod management, but I couldn't find any for generic Kubernetes <em>cluster</em> management (ie create cluster etc.))</p>

Jonathan Sylvester
<p>You could consider using the <a href="https://www.terraform.io/docs/providers/google/r/container_cluster.html" rel="nofollow noreferrer">Terraform GKE provider</a> to programmatically create and mange GKE clusters.
It is idempotent and tracks state. I'd consider it to be more stable than any standalone library implementation. Besides, this is a typical use case for Terraform.</p>
