SlideShare a Scribd company logo
Cloud Platform and Kubernetes
Google Developer Group Aarhus Meet-up
Thursday, 28th April 2016
Martin Jensen & Kasper Nissen
www.rpi-cloud.com
@mrjensens @phennex
Views and opinions are our own.
We do not work for, nor do we speak on behalf of .
So, who are these people then?
Bachelor: B.Eng ICT


Master: M.Eng. Computer Engineering
(specialization Distributed Systems and Software Engineering)
Experience: Software Developer @ IT Minds
Technologies: Java, C#, iOS (Objective-C/Swift), Android,
JavaScript (jQuery/Ember.JS), ASP.Net MVC, SQL Server,
Postgres, MongoDB, Docker, Kubernetes ...
Interests: Cloud computing/architecture, technology
evolution, distributed systems, mobile development
Martin Jensen
foto: Lars Kruse, Aarhus Universitet
Bachelor: B.Eng ICT


Master: M.Eng. Computer Engineering
(specialization Distributed Systems and Software Engineering)
Experience: Software Developer @ IT Minds, Partner @
Drivelogger, Founder @ Let’s Talk Apple Aarhus
Technologies: Java, C#, iOS (Objective-C/Swift), Android,
JavaScript (jQuery/Ember.JS), ASP.Net MVC, SQL Server,
Postgres, MongoDB, Docker, Kubernetes ...
Interests: Cloud computing/architecture, technology
evolution, distributed systems, mobile development
Kasper Nissen
Pervasive Systems group, Section of Electrical and Computer Engineering, Department of Engineering, Aarhus University
Let’s get started with a short introduction to Cloud Computing…
What is Cloud Computing?
Google Cloud Platform and Kubernetes
- “Cloud computing refers to applications and services that run on a distributed network using
virtualized resources and accessed by common Internet protocols and networking
standards.” - B. Sosinsky, The Cloud Computing Bible
- Key enabling concepts
- Abstraction: Cloud computing abstracts the details of system implementation from
users and developers
- Virtualization: Cloud computing virtualizes systems by pooling and sharing
resources
- Cloud types
- Deployment models: Public, Private, Hybrid, Community
- Service models: IaaS, PaaS, SaaS, (CaaS)
What is Cloud Computing?
Source: “The Cloud Computing Bible”, B.Sosinsky, page 10
- On-demand self-service
- Broad network access
- Resource pooling
- Rapid elasticity
- Measured service
- Lower costs
- Ease of utilization
- Quality of Service
- Reliability
- Outsourced IT Management
Benefits of Cloud Computing?
Source: “The Cloud Computing Bible”, B.Sosinsky, page 17
- More suitable for large organizations
- Less customizable
- Latency
- Privacy and security
Disadvantages of Cloud Computing?
Source: “The Cloud Computing Bible”, B.Sosinsky, page 17
What about Software Architecture?
Source: http://reiserobby.de/norwegen-trauer-um-todesopfer-von-oslo-und-utoya-mindestens-87-tote/os_monolith/Source: https://thirdeyemom.com/2015/07/07/the-great-american-road-trip-mount-rushmore/
Monolithic architecture
“A monolith application, in layman terms, is where entire
functionality of the application is packaged together as a single
unit or application” - Arun Gupta, 2015
Source: http://reiserobby.de/norwegen-trauer-um-todesopfer-von-oslo-und-utoya-mindestens-87-tote/os_monolith/
Microservice architecture
“Small Autonomous services that work together, modelled around a business domain” - Sam Newman, 2015
Source: http://d195zpdxad0ld.cloudfront.net/media/W1siZiIsIjIwMTIvMDUvMjUvMTVfMDVfMjhfNjkwX1N0b25laGVuZ2VfYXRfZGF3bi5qcGciXSxbImUiLCJqcGciLCItcXVhbGl0eSA2MCJdLFsicCIsInN0cmlwIl1d/
Stonehenge%20at%20dawn.jpg
Monolithic vs Microservice architecture
Source: http://martinfowler.com/articles/microservices.html
Design for failure - Resilience in a distributed system?
resilience
or resiliency
[ri-zil-yuh ns, -zil-ee-uh ns]
noun
1. the power or ability to return to the original form, position, etc., after being bent,
compressed, or stretched: elasticity.
2. ability to recover readily from illness, depression, adversity, or the like; buoyancy
Source: http://www.dictionary.com/browse/resilience
Google Cloud Platform and Kubernetes
THINGS WILL GO WRONG
EMBRACE FAILURES
The fallacies of distributed computing

1. The network is reliable
2. Latency is zero
3. Bandwidth is infinite
4.The network is secure
5. Topology doesn’t change
6. There is one administrator
7. Transport cost is zero
8. The network is homogeneous
- Application level
- Synchronous/Asynchronous architecture (request/response, message queues)
- Apply circuit breakers at integration points
- Rather degradation of service than failures
- Manage timeouts
- Bulkheads
- Health checks
- Infrastructure level
- Fault tolerance
- Infrastructure that detects failures
What can we do?
What is a Container?
Google Cloud Platform and Kubernetes
The challenges
Source: http://pointful.github.io/docker-intro/
Intermodal shipping container
Source: http://pointful.github.io/docker-intro/
Docker is a container system for code
Source: http://pointful.github.io/docker-intro/
What is Continuous Delivery?
Source: https://www.robots.com/images/Robot%20Integration.jpg
What is Service Discovery?
Google Cloud Platform and Kubernetes
A little tour of the
cloud.google.com
Who uses Google Cloud Platform?
Google Cloud Platform and Kubernetes
Google Cloud Platform and Kubernetes
An overview of all the goodies
An overview of all the goodies
An overview of all the goodies
An overview of all the goodies
An overview of all the goodies
An overview of all the goodies
An overview of all the goodies
Google Cloud Compute
Google Container Engine
Fully Managed
Container Engine is fully managed by Google reliability
engineers, ensuring your cluster is available and up-to-
date.
Private Container Registry
Google Container Registry makes it easy to store and
access your private Docker images.
Scalable
Easily adjust the cluster resources allocated to your
containers, or the size of your container cluster, as
your application's requirements change.
Docker Support
Container Engine supports the common Docker
container format.
Logging
Enable Google Cloud Logging with a single checkbox,
making it easy to gain insight into how your
application is running
Hybrid Networking
Reserve an IP address range for your container cluster,
allowing your cluster IPs to coexist with private
network IPs via Google Cloud VPN.
Source: https://cloud.google.com/container-engine/
Google Container Registry
Container Engine
Use container images with Container Engine with no
authentication setup.
Advanced Authentication
Easily integrate with your favorite continuous
integration, continuous delivery, and container
orchestration systems with native Docker Login
support.
Container Tags
Add and remove image tags with a simple click in the
web UI.
Docker V2 Registry API Support
Push and pull Docker images to your private Container
Registry using the V2 API.
Docker CLI Integration
Pull container images from Container Registry using
the standard Docker command line interface.
Regional Repositories
Get the fastest possible pull times by storing your
images close to your Compute Engine instances in
Europe, Asia, or US regional Cloud Storage buckets.
Search Images
Quickly search for images by name and tag.
Nearline Storage Integration
Archival storage of images in Cloud Storage Nearline
buckets.
Source: https://cloud.google.com/container-registry/
Kubernetes - Infrastructure For Everyone Else
Kubernetes is an open-source system for automating deployment, operations,
and scaling of containerized applications.
#GIFEE
Google Cloud Platform and Kubernetes
How to manage all these containers?
Google Cloud Platform and Kubernetes
How to utilize the resources we have?
Machine utilization
- Machine shapes
- Workload shapes
- Bin packing problem
Where should we deploy this workload?
2.5GB
1Core
Source: bit.ly/1PrkwoN
Let’s play some tetris
“Containerization transforms the data center
from being machine-oriented to being
application-oriented”
Burns et al., Borg, Omega, and Kubernetes, 2016
Source: research.google.com/pubs/pub44843.html
- Greek for “pilot” or “helmsman of a ship”
- Runs and manages containers
- Builds on Googles experiences running a hyper-scale webplatform for more than 10 years.
- Inspired by Googles internal Cluster Management and scheduling platform, “Borg”
- Supports multiple cloud and bare-metal environments
- 100% Open source, written in Go
What is Kubernetes?
Source: https://youtu.be/_xNFt7FsWaA
Velocity
Source: https://youtu.be/_xNFt7FsWaA
Community
Source: https://youtu.be/_xNFt7FsWaA
Everything at Google runs in containers
- Gmail, Web search, …
- MapReduce, batch, …
- GFS, Colossus, …
- Even Google’s Cloud Platform:

VMs run in containers
In fact, launches over 2 billion containers per week.
Google and Containers
How does it work?
Let’s have a look a some of the concepts
Pods
Pods
- Kubernetes uses nested containers
- The outer-most one provides a pool of resources, and is called a pod
- The inner ones provide deployment isolation
- Kubernetes regularizes things and always run an application container inside a top-level
pod, even if the pod contains a single container
- “A pod is a collection of containers that are tightly bound”, Brian Dorsey
- The atom of scheduling for containers
- Runs on the same virtual/physical host
Pods
Pod
Web server
Container
Pod
Web server
Consumers
Container
Git sync
Container
Git repoConsumers
Inspiration: http://bit.ly/1rmC0cz
Pod networking
Pod networking
- Pods have IPs which are routable
- Pods can communicate directly with each other
- Even across nodes
- No brokering of Port Numbers
- Many solutions
- Flannel (what we use in the Raspberry Pi Cluster)
- Cloud Providers
Pod networking
Pod
Container
10.1.2.106
10.1.2.0/24
Pod
Container
10.1.1.211
10.1.1.0/24
Pod
Container
10.1.3.175
10.1.3.0/24
Node
Node
Node
Inspiration: http://bit.ly/1rmC0cz
Services
Services
- A service has a static IP and a DNS entry
- Acts as a load-balancer and knows how to route traffic to pods
- Load balances incoming request across constituent pods
Services
Pod
Web server
Container
Pod
Web server
Container
Pod
Web server
Container
type=FE type=FE type=FE
Consumers
Service
VIP
Label selector:
type=FE
Inspiration: http://bit.ly/1rmC0cz
Labels
Labels
- Labels are simple key/value pairs
- Kubernetes connects things together with labels
- Only grouping mechanism in Kubernetes
- Reduces coupling
Web server
Container
track=staging
app=webserver
tier=frontend
Pod
Labels
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
version=2
version=2
Dashboard Dashboard
show: type=FE show: version=v2
Inspiration: http://bit.ly/1rmC0cz
Replica Sets
Hey!
You always wear
the same as I do
ReplicaSets
- A Replica Set ensures that a specified number of pods “replicas” are running at any given
time.
- Replica Set is the next-generation Replication Controller
- The only difference right now is the selector support (set-based support)
- Use deployments to control your Replica Sets
Replica Sets
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
type=FE
Dashboard Dashboard
Current: 3
Desired: 3
Deployment
Source: http://imgur.com/tjD4L
Deployments
OH F*CK!
Not again!
Whyyyyyy…
Deployments
- Deployment is a higher-level concept that manages replica sets, pods and provides
declarative updates to pods along with a lot of other useful features
- You only need to describe the desired state in a Deployment object, and the Deployment
controller will change the actual state to the desired state at a controlled rate for you
- Deploying a new version will result in a rolling-update, where Kubernetes will replace one
pod at a time until all are running the latest version.
Deployments
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
type=FE
Dashboard
Current: 3
Desired: 3
version=2 version=2 version=2
Pod
Container
type=FE
version=3
New version
Deployment
Deployments
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
type=FE
Dashboard
version=3 version=2 version=2
Deployment
Current: 3
Desired: 3
Deployments
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
type=FE
Dashboard
version=3 version=3 version=2
Deployment
Current: 3
Desired: 3
Deployments
Pod
Container
type=FE
Pod
Container
type=FE
Pod
Container
type=FE
Dashboard
version=3 version=3 version=3
Deployment
Current: 3
Desired: 3
Source: http://imgur.com/tjD4L
Canary
WHAZZZAH!
I’m the new kid
on the stick!
Canary
- Running different versions at the same time
- Testing new features with a subset of your users
Canary
Pod
Container
type=BE
Pod
Container
type=BE
Pod
Container
type=BE
Dashboard Dashboard
Deployment
version=1
type=BE

Current: 2
Desired: 2
Deployment
version=2version=1version=1
version=2
type=BE

Current: 1
Desired: 1
Consumers
Service
VIP
name=backend
Label selector: type=BE
Inspiration: http://bit.ly/1rmC0cz
Source: http://imgur.com/tjD4L
Scaling
I feel inflated today!
Scale (auto)
- Horizontal Pod Autoscaler allows you to automatically scale the number of pods in a
deployment based on observed CPU utilization.
- The autoscaler is implemented as a Kubernetes API resource and controller.
- The resource describes behavior of the controller
- The controller periodically adjusts the number of replicas in a deployment to match the
observed average CPU utilization to the target specified by the user.
Scale (auto)
Pod 1
Container
type=FE
Pod 2
Container
type=FE
Pod N
Container
type=FE
version=3 version=3 version=3
Deployment
Scale
…
Horizontal
Pod
Autoscaler
kubectl autoscale deployment foo --max=5 --cpu-percent=80
Demo application
UI/Gateway
Cat-service Dog-service
config-service
Demo on Raspberry Pi Kubernetes cluster
How can I get started with Kubernetes?
cloud.google.com
- kubernetes.io
- Documentation, great samples, etc.
- Slack: http://slack.k8s.io
- Github: https://github.com/kubernetes/kubernetes
- Pricing:
60 days free trial. You get $300 in credit.
https://cloud.google.com/free-trial/
Demo on Google Container Engine
Thank you
Google Developer Group Aarhus Meet-up
Thursday, 28th April 2016
Martin Jensen & Kasper Nissen
www.rpi-cloud.com
@mrjensens @phennex
References
- Book: “The Cloud computing bible”, Sosinsky, B.
- Link: “Microservices - a definition of this new architectural term”, Fowler, M., Lewis, J.
- martinfowler.com/articles/microservices.html
- Link: “Borg, Omega, and Kubernetes”, Burns, B. et al.
- http://research.google.com/pubs/pub44843.html
- Link: “Introduction to Docker”
- pointful.github.io/docker-intro/

More Related Content

Google Cloud Platform and Kubernetes