Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Deploying WSO2 Middleware on Containers
1. Deploying WSO2 Middleware
on Containers
Lakmal Warusawithana
Director Cloud Architecture, WSO2
VP, Apache Stratos
Imesh Gunaratne
Software Architect, WSO2
2. Agenda
• An Introduction to Docker and Docker Compose
• Building WSO2 Docker Images
• Deploying WSO2 Middleware on Docker with Docker Compose
• An Introduction to Kubernetes
• Deploying WSO2 middleware on Kubernetes
• Kubernetes Vs OpenShift
• Using Puppet and Hiera for Configuration Management
• Automated WSO2 Carbon Cluster Discovery
• An Introduction to Mesos DC/OS
• Deploying WSO2 Middleware on Mesos DC/OS
• CloudFoundry Current Limitations and the Future
28. How to Install Docker?
• For Linux
– wget -qO- https://get.docker.com/ | sh
• For Mac
– https://docs.docker.com/engine/installation/mac/
• For Windows
– https://docs.docker.com/engine/installation/windows/
33. An Introduction to Docker Compose
• Compose is a tool for defining and running
multi-container Docker applications
• In compose yaml can define your application’s
services
• Using a single command, you create and start
all the services from your configuration
• To Install Docker Compose
– https://docs.docker.com/compose/install/
35. Deploying WSO2 Middleware on Docker with
Docker Compose
• Clone https://github.com/lakwarus/wso2am-deployment-
patterns
• Navigate to your patten
• Follow the ReadMe
– docker-compose up
36. Demo: Deploying WSO2 API-
M on Docker with Docker
Compose
Cinema clapperboard icon source: http://www.flaticon.com/free-icon/graph_102534
38. An Introduction to Kubernetes
• An open source container cluster management system
• Started by Google with decade and half experience on
running containers at scale (Borg)
• Written in Go
• Can be deployed on any Infrastructure/IaaS
• Over 600 contributors
http://kubernetes.io/v1.0/docs/whatisk8s.html
40. Kubernetes Pods
● A group of containers which can share
resources and context
● Shared namespaces:
○ PID namespace (processes visible globally)
○ network namespace (same IP and port
space)
○ IPC namespace (SystemV IPC or POSIX)
○ UTS namespace (share a hostname)
http://kubernetes.io/v1.0/docs/user-guide/pods.html
Pod
C1 C2 C3
41. Kubernetes Replication Controllers
● Provides features for replicating pods:
○ Auto-healing
○ Manual scaling
○ Rolling updates
○ Multiple release tracks
http://kubernetes.io/v1.0/docs/user-guide/replication-controller.html
Pod
Template
Replicas = n
Pod 1 Pod 2 Pod n
Replication
Controller
42. Kubernetes Horizontal Pod Autoscaler
● Provides features for horizontally
autoscaling pods
○ CPU consumption based
http://kubernetes.io/v1.1/docs/user-guide/horizontal-pod-autoscaler.html
Pod
Template
Replicas = n
Pod 1 Pod 2 Pod n
Replication
Controller
Horizontal Pod
Autoscaler
43. Kubernetes Services
● Service types:
○ ClusterIP (default)
○ NodePort
○ LoadBalancer
● Service discovery:
○ DNS
○ Environment variables
● Client IP based Session Affinity
http://kubernetes.io/v1.0/docs/user-guide/services.html
Node IP: 172.17.8.102
Port: 9443
Domain Name: service1
IP: 10.2.10.20
Port: 9443
NodePort: 32001
Protocol: TCP
Pod 1 Pod 2 Pod n
Service
L1
L1 L1 L1
Node
44. Overlay Network
● Unique IP addresses
● Provides pod to pod networking
● Options available:
○ Flannel (default)
○ OpenVSwitch
○ Weave
○ Calico
http://kubernetes.io/v1.1/docs/admin/networking.html
45. WSO2 Carbon Reference Architecture 1
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
46. WSO2 Carbon Reference Architecture 2
Pod 1
Gateway Mgr
Services
Pod 2 Pod 3
Gateway Worker
Services
Client
Pod 4 Pod 5
Key Manager
Services
Pod 6 Pod 7
Store Services
Gateway
Mgr RC
Gateway
Worker RC
Key
Manager RC
Store RCGov
Reg
Conf
Reg
User
Store
API-M
DB
Pod 8 Pod 9
Publisher Services
Publisher
RC
53. Introduction to OpenShift
• Based on top of Docker containers and the
Kubernetes container cluster manager
• OpenShift 3 adds
– Developer and operational centric tools to
enable rapid application development
– Easy deployment and scaling
– Long-term lifecycle maintenance for small and
large teams and applications.
https://www.openshift.com
57. How does it work?
http://www.slideshare.net/pk.habi/introduction-to-puppet-16586463
2. Standalone mode
Puppet (Server 1)
puppet apply
Puppet Modules
Puppet (Server 2)
puppet apply
Puppet Modules
Puppet (Server n)
puppet apply
Puppet Modules
58. What is Hiera?
• Hiera is a key/value lookup tool for configuration data.
• It makes Puppet better by keeping site-specific data
out of the manifests.
• Configuration data is stored in YAML files.
• Avoids repetition by introducing common YAML files.
https://docs.puppet.com/hiera/
59. A Sample Hiera YAML File
https://github.com/wso2/puppet-modules
60. Deployment Automation Overview
WSO2 Server
Profiles
Profiles
Profiles
Deployment
Patterns
Deployment
Patterns
Deployment
Patterns
Puppet Module
Templates
Hiera Config
Data
Templates
Templates
Hiera Config
Data
Hiera Config
Data
Hiera Config Hierarchy: Environments -> Products -> Versions -> Platforms -> Patterns
Dev | Test | Pre-
Prod | Prod
VM | K8S | Mesos
61. WSO2 Hiera Config Data Hierarchy
https://github.com/wso2/puppet-modules/blob/master/hiera.yaml
66. What does WSO2 Carbon Clustering
Provides?
• Distributed Caching
• Coordinator Election (Using distributed locks)
• Cluster Communication
• Implemented using Hazelcast
https://docs.wso2.com/display/CLUSTER44x/Overview
67. How Carbon Cluster Discovery Works?
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
69. An Introduction to Apache Mesos
Image source: Anton Kirillov, Data processing platforms architectures [1]
Mesos is an open-source cluster manager that was initially developed at the University of California,
Berkeley in year 2009.
70. An Introduction to Mesos DC/OS
Cluster Manager
PaaS UI | CLI | Package RepositoryBatch Job Scheduler
71. Reference Architecture for Mesos DC/OS
C 1 C 2
Manager Marathon
Applicatio
C 3 C 4 C n
Worker Marathon
Application
Marathon Load
Balancer
Gov
Reg
Conf
Reg
User
Store
Client
Manager Marathon
Application
Worker Marathon
Application
78. Limitations in the Current Architecture
• A container can only expose one transport/port.
• Only HTTP traffic can be routed via the router.
• SSL get terminated at the router.
• Internal routing rules cannot be defined.
• Autoscaling can only be done based on CPU usage.
Warning icon source: http://www.flaticon.com/free-icon/warning-triangle_10190
79. Reference Architecture for Cloud Foundry
C 1 C 2
Manager Marathon
Applicatio
C 3 C 4 C n
Worker Marathon
Application
CF Router
Gov
Reg
Conf
Reg
User
Store
Client
Manager CF
Application
Worker CF
Application