Containerization is fast becoming the most efficient way to develop and deploy software solutions in the Cloud. Docker embraced this space by fulfilling the above requirements and attracting the industry within a very short period of time. Google solved container cluster management features by initiating the Kubernetes project over a decade of experience on running container technologies at scale.
WSO2 App Cloud enables you to deploy applications using these technologies. In this tutorial we will demonstrate how WSO2 products can be run on Kubernetes. We will also give a preview of the upcoming WSO2 App Cloud which is deeply integrated with Kubernetes for hosting applications.
This tutorial will include
An introduction to Docker and Kubernetes
Deploying WSO2 products on Kubernetes
Kubernetes as the runtime provider for WSO2 App Cloud
How to Troubleshoot Apps for the Modern Connected Worker
WSO2Con ASIA 2016: Revolutionizing WSO2 App Cloud with Kubernetes & Docker
1.
2. Agenda
• An Introduction to Virtualization
• An Introduction to Containers
• An Introduction to Docker
• An Introduction to Kubernetes
• Deploying WSO2 products on Kubernetes
• WSO2 Cloud Ecosystem
• Demo on App Cloud
3. Virtualization
• Enables multiple operating systems
to run on a single host computer
• Benefits
• Saves money
• Resource optimization
Server
Host OS
Hypervisor
Guest OS Guest OS
Bins/ Libs Bins/ Libs
A
p
p
A
p
p
A
p
p
A
p
p
5. Containers
• Reduced the requirement to have an
OS for each application
• OS level virtualization, NO hypervisor
(Hypervisor abstracts an entire device,
containers just abstract the OS kernel.) Server
Host OS
Bins/ Libs Bins/ Libs
A
p
p
A
p
p
A
p
p
A
p
p
6. LXC - Linux Containers
• A tool that Implements the container concept in Linux
• Make use of Host OS Kernel features
• Namespaces -> separates process tree, network, file access
• cgroups -> isolate CPU / memory / network resources
• chroot -> isolate access to disk
• Other implementations
• FreeBSD -> Jails, Solaris -> Zones
8. Docker
• Started as a project by dotCloud
• Initially based on LXC,
but now build their own
implementation -> libcontainer
https://en.wikipedia.org/wiki/Docker_(software)
16. • Docker → Container lifecycle management
Kubernetes → Orchestration and container cluster
management
• First announced by Google, in 2014,
v1.0 released in July 2015
https://en.wikipedia.org/wiki/Kubernetes
17. Why Container Clusters?
• Avoid single point of failure
• Make horizontally scalable
• Have more granular
management for distributed
applications (microservices)
• Self healing systems
http://googlecloudplatform.blogspot.com/2015/01/what-makes-a-container-cluster.html
[image ref] https://www.docker.com/what-docker
18. Kubernetes Architecture
Docker Host 1 Docker Host 2 Docker Host n
Physical Network
Controller Host
KubernetesAPI
Overlay Network (SDN)Scheduler
Getting Started with Kubernetes, Jonathan Baier
19. Kubernetes Pods
● A group of containers which can share
resources and context
● Shared namespaces:
○ PID namespace (can see each other’s processes)
○ network namespace (same IP and port space)
○ IPC namespace (SystemV IPC or POSIX)
○ UTS namespace (share a hostname)
Pod
C1 C2 C3
http://kubernetes.io/v1.0/docs/user-guide/pods.html
20. Kubernetes Labels & Selectors
● Labels are key/value pairs
attached to objects
● Selectors use the label key to
find a collection of objects
matched with the same value
○ L1 -> ClusterID = C1
○ L2 -> ClusterID = C2
Pod 1
http://kubernetes.io/v1.0/docs/user-guide/labels.html
L1
Pod 2
L1
Pod 3
L1
Pod 3
L2
Pod 4
L2
21. Pod
Template
Replicas = n
Kubernetes Replication Controllers
● Provides features for replicating
pods:
○ Auto-healing
○ Scaling
○ Rolling updates
Pod 1
http://kubernetes.io/v1.0/docs/user-guide/replication-controller.html
Pod 2 Pod n
Replication
Controller
22. Node IP: 172.17.8.102
Port: 9443
Domain Name: service1
IP: 10.2.10.20
Port: 9443
NodePort: 32001
Protocol: TCP
Kubernetes Services
● Service types:
○ ClusterIP (default)
○ NodePort
○ LoadBalancer
● Service discovery:
○ DNS
○ Environment variables
● Session Affinity
Pod 1
http://kubernetes.io/v1.0/docs/user-guide/services.html
Pod 2 Pod n
Service
L1
L1 L1 L1
Node
23. ● A distributed key value store
● Read and write values with curl
and other HTTP libraries
● Store data in directories, similar
to a file system
● Watch a key or directory for
changes and react to the new
values
https://coreos.com/etcd/
etcd
24. ● A software defined network
● Runs an agent, flanneld, on each
host
● Uses etcd to store the network
configuration, allocated subnets,
and auxiliary data (host ips)
https://github.com/coreos/flannel
flannel
26. Carbon Cluster Discovery on
Kubernetes
Pod 1 Pod 2 Pod n
Service
Server 1 Server 2 Server n
Pod 1
Service
Server 1
Pod 1 Pod 2
Service
Server 1 Server 2
Hazelcast member
initialization
Hazelcast member
initialization
Hazelcast member
initialization
1 2 n
27. WSO2 Carbon Reference Architecture
for Kubernetes
Pod 1 Pod 2
Manager Cluster
Services
Pod 3 Pod 4 Pod n
Worker Cluster
Services
Manager
Replication
Controller
Worker Replication
Controller
Client
Gov
Reg
Conf
Reg
User
Store
https://github.com/wso2/kubernetes-artifacts