Google Container Engine

Untitled drawing

Container Engine is the third and last component of the Compute layer of Google Cloud Platform that I want to explore.

What is Container Engine?

  • Google Container Engine is a Google-hosted version of Kubernetes running on Compute Engine. 
  • Kubernetes is an open source orchestration system for Docker containers.
  • Basically, Container Engine enables you to host Docker containers with Kubernetes very easily. For more details, on why containers makes sense, see: An introduction to containers, Kubernetes, and the trajectory of modern cloud computing.
  • Most useful command lines tools for Container Engine:
    • gcloud: used to push Docker images, create cluster.
    • kubectl: used to send requests to Kubernetes cluster manager (eg. to create Kubernetes pods, services, get cluster info and scale up/down pods).

Container Engine App Lifecycle

These are roughly the steps you need to follow in order to host the app in a Kubernetes backed cluster in Container Engine for the first time:

  1. Create your app.
  2. Create a Docker image containing your app.
  3. Build Docker image and run it locally to make sure it works as expected.
  4. Push the Docker image to Google Container Registry.
  5. Create a Kubernetes cluster: A cluster consists of a master API server hosted by Google and a set of worker nodes which are Compute Engine VMs.
  6. Create a Kubernetes pod: A pod is a group of containers for Kubernetes to manage together, from the Docker image pushed earlier.
  7. Expose the pod as a Kubernetes service to make it accessible to the outside world.

If you need to update an existing app:

  1. Make the needed changes to your app.
  2. Build and test a new docker image locally.
  3. Push the new image to Google Container Registry.
  4. Do a rolling-update using kubectl command.

Resources