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:
- Create your app.
- Create a Docker image containing your app.
- Build Docker image and run it locally to make sure it works as expected.
- Push the Docker image to Google Container Registry.
- 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.
- Create a Kubernetes pod: A pod is a group of containers for Kubernetes to manage together, from the Docker image pushed earlier.
- Expose the pod as a Kubernetes service to make it accessible to the outside world.
If you need to update an existing app:
- Make the needed changes to your app.
- Build and test a new docker image locally.
- Push the new image to Google Container Registry.
- Do a rolling-update using kubectl command.
Resources