kubernetesgoogle-cloud-platformgoogle-cloud-repository

Deploy container images to kubernetes to google cloud from java/node js


I am trying to do some experiments with Kubernetes in google cloud.

I have docker image in google cloud registry and need to deploy that image to a kubernetes cluster.

Here are the steps I need to perform.

  1. Create a Kubernetes cluster.
  2. Copy the image from GCR and deploy to Kubernetes cluster.
  3. Expose the cluster to internet via load balancer.

I know, it is possible to do via google cloud sdk cli. Is there way to do these steps via Java/node js?


Solution

  • There is a RESTful kubernetes-engine API:

    https://cloud.google.com/kubernetes-engine/docs/reference/api-organization

    e.g. create a cluster:

    https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.zones.clusters/create

    The container registry should be standard docker APIs.

    Both Java and Node have kubernetes clients:

    https://github.com/kubernetes-client/java https://github.com/godaddy/kubernetes-client