Home >

Hightower et al. Kubernetes: Up and Running: Dive into the Future of Infrastructure

Posted on October 8, 2017 by Ernesto Garbarino

Introduction

Definition

Kubernetes is an open source orchestrator for deploying containerized applications. Kubernetes was originally developed by Google, inspired by a decade of experience deploying scalable, reliable systems in containers via application-oriented APIs.1

Kubernetes is a product that is suited not just to the needs of internet-scale companies but to cloud-native developers of all scales, from a cluster of Raspberry Pi computers to a warehouse full of the latest machines. Kubernetes provides the software necessary to successfully build and deploy reliable, scalable distributed systems.

(Hightower et al., 2017, p. 1)

Benefits

Four key benefits (Hightower et al., 2017, p. 2):

  1. Velocity
  2. Scaling (of both software and teams)
  3. Abstracting your infrastructure
  4. Efficiency

Velocity

Once upon a time, it was OK for a service to be down for maintenance at midnight every night. But today, our users expect constant uptime, even if the software they are running is changing constantly.

(Hightower et al., 2017, p. 2)

Velocity is measured not in terms of the raw number of features you can ship per hour or day, but rather in terms of the number of things you can ship while maintaining a highly available service.

(Hightower et al., 2017, p. 2)

The core concepts that enable [velocity] are immutability, declarative configuration, and online self-healing systems.

Immutability

(Hightower et al., 2017, p. 3)

Declarative Configuration

(Hightower et al., 2017, p. 4)

Self-Healing System

(Hightower et al., 2017, pp. 4–5)

Scaling Your Service and Your Teams

Kubernetes achieves scalability by favoring decoupled architectures. (Hightower et al., 2017, p. 5)

Decoupling

(Hightower et al., 2017, p. 5)

Easy Scaling for Applications and Clusters

(Hightower et al., 2017, p. 6)

Scaling Development Teams with Microservices

Kubernetes provides numerous abstractions and APIs that make it easier to build these decoupled microservice architectures. (Hightower et al., 2017, pp. 6–7)

Separation of Concerns for Consistency and Scaling

(Hightower et al., 2017, pp. 7–8)

An illustration of how different operations teams are decoupled using APIs
An illustration of how different operations teams are decoupled using APIs

Abstracting Your Infrastructure

Key points: (Hightower et al., 2017, p. 9)

Efficiency

Key points: (Hightower et al., 2017, pp. 9–10)

Docker Containers

Containers fall into two main categories: (Hightower et al., 2017, pp. 15–16)

Pitfalls (Hightower et al., 2017, pp. 16–17)

Public vs Private Docker Registry Pitfalls (Hightower et al., 2017, p. 18)

Examples of registries: Docker Hub, Google Container Registry.

Examples (Hightower et al., 2017, p. 19)

Limiting memory

docker run -d --name kuard --publish 8080:8080 --memory 200m --memory-swap 1G gcr.io/kuar-demo/kuard-amd64:1

Limiting CPU resources

docker run -d --name kuard  --publish 8080:8080   --memory 200m  --memory-swap 1G --cpu-shares 1024  gcr.io/kuar-demo/kuard-amd64:1

Tips

Deploying a Kubernetes Cluster

(Hightower et al., 2017, Chapter 3)

Google Container Service

Set default zone

gcloud config set compute/zone us-west1-a

Create cluster

gcloud container clusters create kuar-cluster

Credentials

gcloud auth application-default login

Azure Container Service

Set default zone

az group create --name=kuar --location=westus

Create cluster

az acs create --orchestrator-type=kubernetes --resource-group=kuar --name=kuar-cluster

Credentials

az acs kubernetes get-credentials --resource-group=kuar --name=kuar-cluster

Install kubectl tool

az acs kubernetes install-cli

AWS

No KaaS as of book publication:

Minikube (Local)

Minikube provides an easy-to-use way to get a local Kubernetes cluster up running in a VM on your local laptop or desktop. Though this is attractive, minikube only creates a single-node cluster, which doesn’t quite demonstrate all of the aspects of a complete Kubernetes cluster.

Install Minikube

Examples

minikube start
minikube stop
minikube delete
gcloud container clusters create rato-cluster

gcloud components install kubectl

gcloud container clusters get-credentials rato-cluster

gcloud container clusters list

kubectl run hello-web --image=gcr.io/google-samples/hello-app:1.0 --port=8080

kubectl expose deployment hello-web --type="LoadBalancer"

kubectl get service hello-web
Obtain IP address (if <pending> it may take a while)



Version

kubectl version
Both the API and Server version




Checking Cluster Status



C:\Users\Ernie>kubectl get componentstatuses
NAME                 STATUS    MESSAGE              ERROR
controller-manager   Healthy   ok
scheduler            Healthy   ok
etcd-1               Healthy   {"health": "true"}
etcd-0               Healthy   {"health": "true"}


* controller-manager: top management component
* scheduler: placing of pods onto different nodes in the cluster
* etcd: storage of API objects 


List worker nodes


C:\Users\Ernie>kubectl get nodes
NAME                                          STATUS    AGE       VERSION
gke-rato-cluster-default-pool-2dfe4285-3mrs   Ready     1h        v1.7.6
gke-rato-cluster-default-pool-2dfe4285-kdbs   Ready     1h        v1.7.6
gke-rato-cluster-default-pool-2dfe4285-zbpx   Ready     1h        v1.7.6



kubectl get all --all-namespaces=true
kubectl get all --namespace default
kubectl get all --namespace kube-system

C:\Users\Ernie>kubectl logs hello-web-967542450-jg652


BibTeX

@book{hightower2017,
  Author = {Kelsey Hightower and Brendan Burns and Joe Beda},
  Title = {{Kubernetes: Up and Running: Dive into the Future of Infrastructure}},
  Publisher = {O'Reilly Media},
  Year = {2017},
  ISBN = {978-1-491-93567-5}
}

References

Hightower, K., Burns, B., Beda, J., 2017. Kubernetes: Up and Running: Dive into the Future of Infrastructure. O’Reilly Media.


  1. Brendan Burns et al., “Borg, Omega, and Kubernetes: Lessons Learned from Three Container-Management Systems over a Decade,” ACM Queue 14 (2016): 70–93, available at http://bit.ly/2vIrL4S.