Easy Kubernetes

on google container engine

Posted by on March 06, 2017 · 3 mins read

Following my earlier discussion of enterprise orchestration, I decided to look closer at hosted Kubernetes clusters from Google Cloud, Microsoft Azure, and AWS Cloud. To start with, I’ll be trying out the free trial of Google Container Engine.

Getting Started with GCloud

First off, I installed the GCloud SDK on my workstation, Ubuntu 16.04:

export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-cloud-sdk kubectl
gcloud init

I then setup API credentials for my gcloud CLI. First I created a credential, then downloaded the key as JSON:

sudo gcloud auth activate-service-account --key-file MyProject-1234325.json

Create the Kubernetes Cluster

Then in Google Cloud Console, I created the new Kubernetes cluster:

After creation, the console showed the newly running Kubernetes cluster (3 nodes):

I then connected from my local kubectl util:

gcloud container clusters get-credentials mykube --zone us-central1-a --project <project-id>
kubectl proxy

This opened a local proxy to my Kubernetes cluster’s Admin Dashboard:

Which I then scaled from one to three pods with:

kubectl scale --replicas=3 deployment/nginx-test

Since, I’d set the nginx-test deployment to be available as an external service on the Kubernetes clsuter, I could view it in a browser from my workstation:

For more useful Kubernetes commands, see the kubectl documentation.

Monitoring and Logging

Google Cloud makes it easy to add both monitoring and logging of your Kubernetes cluster. For example, I could quickly find Nginx events from the launched pods:

The monitoring dashboard allows one to see CPU, memory, and disk usage (example below):

Stackdriver is free for GCP VM monitoring and email alerts. A premium tier offers combined monitoring of AWS instances as well, plus notifications in Slack, PagerDuty and more.

Summary

After evaluating various container orchestrators and cloud providers, I’m now convinced that:

  1. Distributed container orchestrators are the next operating system… required knowledge for software developers.
  2. As the leader in developer mind-share, Kubernetes has become the API to deploy against, offering portability amongst cloud providers.
  3. Use managed clusters, like GKE, rather than spending your time on bare-bones VMs.

Software development best practice is now containerized deployments on an industry-standard orchestator, run by your preferred cloud platform.

More in this series…