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
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
An Introduction to Containers
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
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
An Introduction to Docker
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)
Virtual Machines vs Docker
https://www.docker.com/what-docker
Why Docker?
• Continuous integration / deployment benefits
• portable deployments
• Lightweight
• more efficient use of RAM
• layered filesystem
• Scale (up / down) quickly
• Easy to distribute / share
• dockerhub
Enterprise Docker, Adrien BLIND, Aurelien GABET, Arnaud MAZIN
FROM ubuntu:14.04
WORKDIR /opt/
ADD packs/jdk-7u4-linux-x64.tar.gz /opt/
RUN ln -s /opt/jdk1.7.0_04 /opt/java
WORKDIR /mnt/
ADD packs/wso2as-5.2.1.zip /mnt/wso2as-5.2.1.zip
RUN unzip -q wso2as-5.2.1.zip
EXPOSE 22 9443 9763
ADD run /usr/local/bin/run
RUN chmod +x /usr/local/bin/run
ENTRYPOINT /usr/local/bin/run
https://www.docker.com
•
•
•
•
•
•
•
•
[1] https://docs.docker.com/engine/installation/
[2] https://github.com/sajhak/wso2as-docker
• 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
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
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
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
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
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
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
● 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
● 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
Deploying WSO2 products on
Kubernetes
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
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
•
•
•
•
•
•
•
•
[1] https://github.com/imesh/kubernetes-vagrant-setup
•
•
•
•
➢
➢
•
•
➢
➢
➢
•
•
…
•
•
➢
➢
➢
➢
➢
•
➢
➢
➢
WSO2Con ASIA 2016: Revolutionizing WSO2 App Cloud with Kubernetes & Docker

WSO2Con ASIA 2016: Revolutionizing WSO2 App Cloud with Kubernetes & Docker

  • 2.
    Agenda • An Introductionto 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 multipleoperating 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
  • 4.
  • 5.
    Containers • Reduced therequirement 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 - LinuxContainers • 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
  • 7.
  • 8.
    Docker • Started asa project by dotCloud • Initially based on LXC, but now build their own implementation -> libcontainer https://en.wikipedia.org/wiki/Docker_(software)
  • 9.
    Virtual Machines vsDocker https://www.docker.com/what-docker
  • 10.
    Why Docker? • Continuousintegration / deployment benefits • portable deployments • Lightweight • more efficient use of RAM • layered filesystem • Scale (up / down) quickly • Easy to distribute / share • dockerhub
  • 11.
    Enterprise Docker, AdrienBLIND, Aurelien GABET, Arnaud MAZIN
  • 12.
    FROM ubuntu:14.04 WORKDIR /opt/ ADDpacks/jdk-7u4-linux-x64.tar.gz /opt/ RUN ln -s /opt/jdk1.7.0_04 /opt/java WORKDIR /mnt/ ADD packs/wso2as-5.2.1.zip /mnt/wso2as-5.2.1.zip RUN unzip -q wso2as-5.2.1.zip EXPOSE 22 9443 9763 ADD run /usr/local/bin/run RUN chmod +x /usr/local/bin/run ENTRYPOINT /usr/local/bin/run
  • 13.
  • 14.
  • 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 Host1 Docker Host 2 Docker Host n Physical Network Controller Host KubernetesAPI Overlay Network (SDN)Scheduler Getting Started with Kubernetes, Jonathan Baier
  • 19.
    Kubernetes Pods ● Agroup 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 KubernetesReplication 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 distributedkey 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 softwaredefined 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
  • 25.
  • 26.
    Carbon Cluster Discoveryon 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 ReferenceArchitecture 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
  • 28.
  • 29.
  • 30.
  • 31.
  • 34.
  • 37.
  • 38.