SlideShare a Scribd company logo
WSO2 Kubernetes Reference
Architecture
Imesh Gunaratne, WSO2
November, 2017
Agenda
● An Introduction to Containers
● An Introduction to Kubernetes
○ Kubernetes Architecture
○ Kubernetes Components
● WSO2 Reference Architecture for Kubernetes
○ Container Orchestration
○ Service Discovery
○ Cluster Discovery
○ Runtime Artifact Synchronization
○ Configuration Management
○ Autoscaling
Agenda Cont.
● Security
○ Security Best Practices
○ Container Security
○ Pod Security Policies
● Deployment Process
○ WSO2 Update Manager (WUM)
○ Kubernetes Resource Deployment
● Rolling Out Updates
○ Kubernetes Rollout
○ Blue/Green Deployment
● Monitoring The Deployment
● WSO2 Kubernetes Resources
An Introduction to Containers
Virtual Machines Vs Containers
Linux Container Brief for IEEE WG P2302, Boden Russell
Hardware
Hypervisor
Virtual Machine
Operating
System
Bin/Lib
App App
Virtual Machine
Operating
System
Bin/Lib
App App
Hardware
Operating System
Hypervisor
Virtual Machine
Operating
System
Bin/Lib
App App
Virtual Machine
Operating
System
Bin/Lib
App App
Type 1 Hypervisor
(Bare Metal)
Type 2 Hypervisor
Hardware
Operating System
Linux Containers
Container
Bin/Lib
App
Container
Bin/Lib
App
Container Runtime
The Container Advantage
Hardware
Hypervisor
Virtual Machine
Operating
System
Bin/Lib
App App
Virtual Machine
Operating
System
Bin/Lib
App App
Type 1 Hypervisor
Hardware
Operating System
Linux Containers
Container
Bin/Lib
App
Container
Bin/Lib
App
16 CPU, 128 GB
RAM
2 CPU, 4 GB RAM
1 CPU, 1.25 GB
RAM
1 CPU, 0.75 GB RAM
16 CPU, 128 GB
RAM
2 CPU, 4 GB RAM
2 CPU, 2 GB RAM
Container Runtime
Operating System
Standard Container Deployments
Container Image
Container Images
Hardware
Operating System
Container
Bin/Lib
App
Container
Bin/Lib
App
Container Runtime
Container Image Registry
Operating System
Container
Bin/Lib
App
Container
Bin/Lib
App
Container Runtime
Load Balancer
Hardware
Network
Container Cluster Manager based Deployments
Overlay Network
Container Images
Hardware
Operating System
Container
Bin/Lib
App
Container
Bin/Lib
App
Container Runtime
Container Image Registry
Operating System
Container
Bin/Lib
App
Container
Bin/Lib
App
Load Balancer
Hardware
Network
Hardware
Operating System
Container Cluster
Manager Controller
Agent Container Runtime Agent
An Introduction to Kubernetes
An Introduction to Kubernetes
Borg
Google’s first container
cluster manager
Omega
Google’s second container
cluster manager
Kubernetes
Google’s initiative to build
a general purpose
container cluster manager
Kubernetes Architecture
Load Balancer
kube-apiserver
● kube-apiserver exposes the Kubernetes API. It is the front-end for the
Kubernetes control plane. It is designed to scale horizontally – that
is, it scales by deploying more instances.
https://kubernetes.io/docs/concepts/overview/components/
etcd
● etcd is used as Kubernetes’ backing store. All cluster data is stored
here. Always have a backup plan for etcd’s data for your Kubernetes
cluster.
https://kubernetes.io/docs/concepts/overview/components/
kube-controller-manager
● kube-controller-manager runs controllers, which are the background
threads that handle routine tasks in the cluster. Logically, each
controller is a separate process, but to reduce complexity, they are
all compiled into a single binary and run in a single process.
● These controllers include:
○ Node Controller: Responsible for noticing and responding when nodes go down.
○ Replication Controller: Responsible for maintaining the correct number of pods
for every replication controller object in the system.
○ Endpoints Controller: Populates the Endpoints object (that is, joins Services &
Pods).
○ Service Account & Token Controllers: Create default accounts and API access
tokens for new namespaces.
https://kubernetes.io/docs/concepts/overview/components/
cloud-controller-manager
● cloud-controller-manager runs controllers that interact with the
underlying cloud providers. The cloud-controller-manager binary is
an alpha feature introduced in Kubernetes release 1.6.
● Extension points:
○ Node Controller: For checking the cloud provider to determine if a node has been
deleted in the cloud after it stops responding
○ Route Controller: For setting up routes in the underlying cloud infrastructure
○ Service Controller: For creating, updating and deleting cloud provider load
balancers
○ Volume Controller: For creating, attaching, and mounting volumes, and
interacting with the cloud provider to orchestrate volumes
https://kubernetes.io/docs/concepts/overview/components/
kube-scheduler
● kube-scheduler watches newly created pods that have no node
assigned, and selects a node for them to run on.
https://kubernetes.io/docs/concepts/overview/components/
DNS
● While the other addons are not strictly required, all Kubernetes
clusters should have cluster DNS, as many examples rely on it.
● Cluster DNS is a DNS server, in addition to the other DNS server(s) in
your environment, which serves DNS records for Kubernetes
services.
● Containers started by Kubernetes automatically include this DNS
server in their DNS searches.
https://kubernetes.io/docs/concepts/overview/components/
Overlay Network Options
https://kubernetes.io/docs/concepts/cluster-administration/networking/
● Cilium
● Contiv
● Contrail
● Flannel
● Google Compute Engine (GCE)
● Kube-router
● L2 networks and linux bridging
● Multus (a Multi Network plugin)
● NSX-T
● Nuage Networks VCS
(Virtualized Cloud Services)
● OpenVSwitch
● OVN (Open Virtual Networking)
● Project Calico
● Romana
● Weave Net from Weaveworks
● CNI-Genie from Huawei
WSO2 Reference Architecture
for Kubernetes
Reference Architecture
Overlay Network
Pod 1 Pod 2
Service 1
Pod 3 Pod 4 Pod m
Service n
Deployments
Load Balancer
DB 1 DB 2 DB X
Persistent Volumes
HPAs
Pod Security Policies
Ingresses
Container Registry
Node1
Node2
Noden
Ingress Controller
WSO2 Docker Images
● WSO2 Docker images are built using standard Dockerfiles
● Default base image used is Ubuntu Server LTS
● Will only include:
○ Oracle JDK 1.8
○ JDBC Driver
○ Latest product distribution
○ Extensions, and Customizations
● Will not include:
○ Configurations (Passed via ConfigMaps)
○ Credentials (Passed via Secrets)
○ Deployable Artifacts (Passed via ConfigMaps)
Container Orchestration
● Deployments will be used for
container orchestration
● Deployments will create replca sets
● Replica sets will internally create
pods
● Deployments will define health
checks for autohealing
● Horizontal pod autoscalers (HPA) will
be used for autoscaling
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
Pod 1 Pod 2
Service
Deployments
Container Registry
Service Discovery
● Kubernetes services will be used
for service discovery
● Each service will have a domain
name
● WSO2 components will use
services to talk to each other
(inter-component communication)
https://kubernetes.io/docs/concepts/services-networking/service/
Pod 1 Pod 2
Service 1
Pod 3 Pod 4
Service n
Cluster Discovery
● Carbon clustering is required for some of
the WSO2 components such as Analytics,
CEP, and IS
● WSO2 Kubernetes membership scheme is
used for auto discoverying members in
the cluster via the Kubernetes API or DNS
Pod 1 Pod 2
Service 1
Pod 2
Kubernetes API DNS
Runtime Artifact Synchronization
● WSO2 components such as Integrator,
BPS, API Gateway would require
synchronizing runtime artifacts
● The recommended approach for this is to
use a Network File System (NFS) and
share the repository/deployment/server
folder of pods via a persistent volume
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
Pod 1 Pod 2
Service
Persistent Volume
Pod n
Configuration Management
● Each configuration folder will be
converted in to a ConfigMap and passed
in to the pod using a volume mount
● This approach makes the configuration
update process simpler
● Would not require to re-build the Docker
images
https://kubernetes.io/docs/concepts/storage/persistent-volumes/
Pod 1 Pod 2
Service
VolumesConfigMaps
Load Balancing
● Internal routing will use Kubernetes
services.
● External routing will use a load balancer
● Ingress definitions will be used to
automatically configure load balancers
via Ingress controllers.
● If required standard load balancers can
also be used with manual configurations.
https://kubernetes.io/docs/concepts/services-networking/ingress/
Pod 1 Pod 2
Service 1
Pod 3 Pod 4
Service n
Load Balancer
Ingresses
Ingress Controller
Autoscaling
● Autoscaling can be applied at two levels:
○ Pod autoscaling
○ Kubernetes cluster autoscaling
● Horizontal pod autoscalers (HPA) will be
used for autoscaling pods.
● Kubernetes cluster autoscaler will scale
the number of Kubernetes nodes
according to the number of pods being
scheduled.
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
https://kubernetes.io/docs/tasks/administer-cluster/cluster-management/#cluster-autoscaling
Pod 1 Pod n
Service
Deployments
HPAs
Kubernetes Package Management
https://docs.helm.sh/
● A chart is a collection of files that describe a related set of
Kubernetes resources.
● A single chart might be used to deploy a simple pod or a
complex application.
● WSO2 plans to implement charts for WSO2 middleware.
● Charts can be managed in Helm repositories.
Security
Security Best Practices
● Ensure container images are free of vulnerabilities
○ Implement continuous security vulnerability scanning
○ Regularly apply security updates
● Ensure that only authorized images are used in your environment
● Limit direct access to kubernetes nodes
● Create administrative boundaries between resources (using
namespaces)
● Define resource quota for pods
● Implement network segmentation when necessary (using network
policies)
● Log everything
http://blog.kubernetes.io/2016/08/security-best-practices-kubernetes-deployment.html
Container Security
● WSO2 containers use a nonroot user for starting the server
processes
● The WSO2 server filesystem will only have required levels of
persmissions in each directory
● Permissions to volume mounts will be granted via Pod
Security Policies
Pod Security Policies
● A Pod Security Policy is a cluster-level resource that controls
the actions that a pod can perform and what it has the ability
to access.
https://kubernetes.io/docs/concepts/policy/pod-security-policy/
Control Aspects of a Pod Security Policy
https://kubernetes.io/docs/concepts/policy/pod-security-policy/
Control Aspect Field Name
Running of privileged containers privileged
Default set of capabilities that will be added to a
container
defaultAddCapabilities
Capabilities that will be dropped from a container requiredDropCapabilities
Capabilities a container can request to be added allowedCapabilities
Controlling the usage of volume types volumes
The use of host networking hostNetwork
The use of host ports hostPorts
The use of host’s PID namespace hostPID
Control Aspects of a Pod Security Policy Cont.
https://kubernetes.io/docs/concepts/policy/pod-security-policy/
Control Aspect Field Name
The use of host’s IPC namespace hostIPC
The SELinux context of the container seLinux
The user ID runAsUser
Configuring allowable supplemental groups supplementalGroups
Allocating an FSGroup that owns the pod’s volumes fsGroup
Requiring the use of a read only root file system readOnlyRootFilesystem
Running of a container that allow privilege escalation
from its parent
allowPrivilegeEscalation
Control whether a process can gain more privileges than
its parent process
defaultAllowPrivilegeEscalation
The Deployment Process
WSO2 Update Manager (WUM)
● Use WUM for downloading latest WSO2 product
distributions including bug and security fixes
http://wso2.com/wum
The Deployment Process
WSO2 Product
Distributions
WSO2 Docker Images
Version Control System Version Control System
Configuaration Files
Deployable
Artifacts
WSO2 Update
Manager (WUM)
Extensions
Updates
Updated WSO2
Product Distributions
Customizations
Oracle JDK
JDBC Driver
Container Registry
ConfigMaps
& Secrets
WSO2 Kubernetes
Resources
KubernetesCluster
WSO2 Docker
Images
Rolling Out Updates
Rolling Out Updates
● Execute a Kubernetes rollout for:
○ WSO2 product updates
○ WSO2 resource updates
○ Or WSO2 configuration changes which are backward
compatible
● If the changes are not backward compatible:
○ Execute a blue/green deployment
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
#rolling-update-deployment
Monitoring the Deployment
Components to Monitor
http://blog.kubernetes.io/2017/05/kubernetes-monitoring-guide.html
Infrastructure
Pods/Containers -> Monitored by
Replica Sets
WSO2 Servers -> Monitored by Deployment
Health Checks
Kubernetes Components
Kubernetes Cluster Health
Kubernetes Node/Pod Health
https://kubernetes.io/docs/tasks/debug-application-cluster/resource-usage-monitoring/
cAdvisorcAdvisor
Node 1
cAdvisor
Heapster
Node 2 Node n
Grafana
InfluxDB
Proposed Kubernetes Monitoring Architecture
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/
monitoring_architecture.md
WSO2 Kubernetes Resources
WSO2 Kubernetes Resources
Currently available:
● https://github.com/wso2/kubernetes-common/
● https://github.com/wso2/kubernetes-apim/
● https://github.com/wso2/kubernetes-ei/
In progress:
● https://github.com/wso2/kubernetes-is/
● https://github.com/wso2/kubernetes-das/
● https://github.com/wso2/kubernetes-iot/
Questions & Feedback

More Related Content

PDF
CyberAgentのインフラについて メディア事業編 #catechchallenge
PDF
eBPFを用いたトレーシングについて
PDF
Deploying OpenStack Object Storage (Swift)
PDF
IP security and VPN presentation
PDF
Multi-Tenancy Kafka cluster for LINE services with 250 billion daily messages
PPTX
Introducing DevOps
PDF
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
PDF
kube-system落としてみました
CyberAgentのインフラについて メディア事業編 #catechchallenge
eBPFを用いたトレーシングについて
Deploying OpenStack Object Storage (Swift)
IP security and VPN presentation
Multi-Tenancy Kafka cluster for LINE services with 250 billion daily messages
Introducing DevOps
GraalVM の概要と、Native Image 化によるSpring Boot 爆速化の夢
kube-system落としてみました

What's hot (20)

PDF
10分でわかる Cilium と XDP / BPF
PDF
Observability; a gentle introduction
PDF
ネットワークでなぜ遅延が生じるのか
PPTX
PDF
Worldwide Scalable and Resilient Messaging Services by CQRS and Event Sourcin...
PDF
Deep dive into highly available open stack architecture openstack summit va...
PDF
ネットワーク通信入門
PDF
Docker & kubernetes
PDF
Kubernetes training
PDF
Shownet2017 report
PDF
Jakarta EE 8 on JDK17
PPTX
Leveraging Nexus Repository Manager at the Heart of DevOps
PPTX
PDF
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
PDF
OpenStack Architecture
PDF
하이퍼레저 프로젝트 개요
PDF
Intro to Network Automation
PPTX
Second session Networking (Network topology)
PDF
Redhat Linux server administration industrial training report.
PDF
「さくらのクラウド」におけるVyattaの活用事例
10分でわかる Cilium と XDP / BPF
Observability; a gentle introduction
ネットワークでなぜ遅延が生じるのか
Worldwide Scalable and Resilient Messaging Services by CQRS and Event Sourcin...
Deep dive into highly available open stack architecture openstack summit va...
ネットワーク通信入門
Docker & kubernetes
Kubernetes training
Shownet2017 report
Jakarta EE 8 on JDK17
Leveraging Nexus Repository Manager at the Heart of DevOps
Zebra SRv6 CLI on Linux Dataplane (ENOG#49)
OpenStack Architecture
하이퍼레저 프로젝트 개요
Intro to Network Automation
Second session Networking (Network topology)
Redhat Linux server administration industrial training report.
「さくらのクラウド」におけるVyattaの活用事例
Ad

Similar to WSO2 Kubernetes Reference Architecture - Nov 2017 (20)

PDF
Deploying WSO2 Middleware on Kubernetes
PPTX
Kubernetes #1 intro
PDF
kubernetesssssssssssssssssssssssssss.pdf
PDF
WSO2 Container Strategy
PDF
Kubernetes for Beginners
ODP
Kubernetes Architecture
PDF
Future of Microservices - Jakub Hadvig
PPTX
Production ready tooling for microservices on kubernetes
PPTX
Containers and Kubernetes -Notes Leo
PDF
Containers kuberenetes
PPTX
Containers kuberenetes
PPTX
Containers kuberenetes
PDF
Kubernetes in Docker
PDF
Running Production-Grade Kubernetes on AWS
PPTX
Container Orchestration using kubernetes
PDF
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
PDF
Revolutionizing WSO2 PaaS with Kubernetes & App Factory
PDF
4. CNCF kubernetes Comparison of-existing-cni-plugins-for-kubernetes
PDF
20250617 [KubeCon JP 2025] containerd - Project Update and Deep Dive.pdf
PPTX
Comparison of existing cni plugins for kubernetes
Deploying WSO2 Middleware on Kubernetes
Kubernetes #1 intro
kubernetesssssssssssssssssssssssssss.pdf
WSO2 Container Strategy
Kubernetes for Beginners
Kubernetes Architecture
Future of Microservices - Jakub Hadvig
Production ready tooling for microservices on kubernetes
Containers and Kubernetes -Notes Leo
Containers kuberenetes
Containers kuberenetes
Containers kuberenetes
Kubernetes in Docker
Running Production-Grade Kubernetes on AWS
Container Orchestration using kubernetes
QConSF18 - Disenchantment: Netflix Titus, its Feisty Team, and Daemons
Revolutionizing WSO2 PaaS with Kubernetes & App Factory
4. CNCF kubernetes Comparison of-existing-cni-plugins-for-kubernetes
20250617 [KubeCon JP 2025] containerd - Project Update and Deep Dive.pdf
Comparison of existing cni plugins for kubernetes
Ad

More from Imesh Gunaratne (20)

PDF
Planning WSO2 Deployments on Pivotal Cloud Foundry
PDF
Planning WSO2 Deployments on DC/OS
PDF
Deep Dive into Kubernetes - Part 2
PDF
Deep Dive into Kubernetes - Part 1
PDF
WSO2 API Manager Reference Architecture for DC/OS
PDF
WSO2 API Manager Reference Architecture for Pivotal Cloud Foundry
PDF
WSO2 Cloud and Platform as a Service Strategy
PDF
Planning Your Cloud Strategy
PDF
Deploying WSO2 Middleware on Containers
PDF
Multitenancy in WSO2 Carbon 5 (C5)
PDF
Deploying WSO2 Middleware on Mesos
PDF
Service Oriented Architecture & Beyond
PDF
Docker for Java Developers
PDF
WSO2 Cloud Strategy Update
PDF
An Introduction to Go
PDF
Scale into Multi-Cloud with Containers
PDF
Making a Better World with Technology Innovations
PDF
Introduction to WSO2 Private PaaS 4.1.0
PDF
Private PaaS for the Enterprise - Apache Stratos & WSO2 Private PaaS
PDF
Apache Stratos 4.1.0 Architecture
Planning WSO2 Deployments on Pivotal Cloud Foundry
Planning WSO2 Deployments on DC/OS
Deep Dive into Kubernetes - Part 2
Deep Dive into Kubernetes - Part 1
WSO2 API Manager Reference Architecture for DC/OS
WSO2 API Manager Reference Architecture for Pivotal Cloud Foundry
WSO2 Cloud and Platform as a Service Strategy
Planning Your Cloud Strategy
Deploying WSO2 Middleware on Containers
Multitenancy in WSO2 Carbon 5 (C5)
Deploying WSO2 Middleware on Mesos
Service Oriented Architecture & Beyond
Docker for Java Developers
WSO2 Cloud Strategy Update
An Introduction to Go
Scale into Multi-Cloud with Containers
Making a Better World with Technology Innovations
Introduction to WSO2 Private PaaS 4.1.0
Private PaaS for the Enterprise - Apache Stratos & WSO2 Private PaaS
Apache Stratos 4.1.0 Architecture

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
Teaching material agriculture food technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Teaching material agriculture food technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Advanced methodologies resolving dimensionality complications for autism neur...
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation theory and applications.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Digital-Transformation-Roadmap-for-Companies.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

WSO2 Kubernetes Reference Architecture - Nov 2017

  • 1. WSO2 Kubernetes Reference Architecture Imesh Gunaratne, WSO2 November, 2017
  • 2. Agenda ● An Introduction to Containers ● An Introduction to Kubernetes ○ Kubernetes Architecture ○ Kubernetes Components ● WSO2 Reference Architecture for Kubernetes ○ Container Orchestration ○ Service Discovery ○ Cluster Discovery ○ Runtime Artifact Synchronization ○ Configuration Management ○ Autoscaling
  • 3. Agenda Cont. ● Security ○ Security Best Practices ○ Container Security ○ Pod Security Policies ● Deployment Process ○ WSO2 Update Manager (WUM) ○ Kubernetes Resource Deployment ● Rolling Out Updates ○ Kubernetes Rollout ○ Blue/Green Deployment ● Monitoring The Deployment ● WSO2 Kubernetes Resources
  • 4. An Introduction to Containers
  • 5. Virtual Machines Vs Containers Linux Container Brief for IEEE WG P2302, Boden Russell Hardware Hypervisor Virtual Machine Operating System Bin/Lib App App Virtual Machine Operating System Bin/Lib App App Hardware Operating System Hypervisor Virtual Machine Operating System Bin/Lib App App Virtual Machine Operating System Bin/Lib App App Type 1 Hypervisor (Bare Metal) Type 2 Hypervisor Hardware Operating System Linux Containers Container Bin/Lib App Container Bin/Lib App Container Runtime
  • 6. The Container Advantage Hardware Hypervisor Virtual Machine Operating System Bin/Lib App App Virtual Machine Operating System Bin/Lib App App Type 1 Hypervisor Hardware Operating System Linux Containers Container Bin/Lib App Container Bin/Lib App 16 CPU, 128 GB RAM 2 CPU, 4 GB RAM 1 CPU, 1.25 GB RAM 1 CPU, 0.75 GB RAM 16 CPU, 128 GB RAM 2 CPU, 4 GB RAM 2 CPU, 2 GB RAM Container Runtime Operating System
  • 7. Standard Container Deployments Container Image Container Images Hardware Operating System Container Bin/Lib App Container Bin/Lib App Container Runtime Container Image Registry Operating System Container Bin/Lib App Container Bin/Lib App Container Runtime Load Balancer Hardware Network
  • 8. Container Cluster Manager based Deployments Overlay Network Container Images Hardware Operating System Container Bin/Lib App Container Bin/Lib App Container Runtime Container Image Registry Operating System Container Bin/Lib App Container Bin/Lib App Load Balancer Hardware Network Hardware Operating System Container Cluster Manager Controller Agent Container Runtime Agent
  • 9. An Introduction to Kubernetes
  • 10. An Introduction to Kubernetes Borg Google’s first container cluster manager Omega Google’s second container cluster manager Kubernetes Google’s initiative to build a general purpose container cluster manager
  • 12. kube-apiserver ● kube-apiserver exposes the Kubernetes API. It is the front-end for the Kubernetes control plane. It is designed to scale horizontally – that is, it scales by deploying more instances. https://kubernetes.io/docs/concepts/overview/components/
  • 13. etcd ● etcd is used as Kubernetes’ backing store. All cluster data is stored here. Always have a backup plan for etcd’s data for your Kubernetes cluster. https://kubernetes.io/docs/concepts/overview/components/
  • 14. kube-controller-manager ● kube-controller-manager runs controllers, which are the background threads that handle routine tasks in the cluster. Logically, each controller is a separate process, but to reduce complexity, they are all compiled into a single binary and run in a single process. ● These controllers include: ○ Node Controller: Responsible for noticing and responding when nodes go down. ○ Replication Controller: Responsible for maintaining the correct number of pods for every replication controller object in the system. ○ Endpoints Controller: Populates the Endpoints object (that is, joins Services & Pods). ○ Service Account & Token Controllers: Create default accounts and API access tokens for new namespaces. https://kubernetes.io/docs/concepts/overview/components/
  • 15. cloud-controller-manager ● cloud-controller-manager runs controllers that interact with the underlying cloud providers. The cloud-controller-manager binary is an alpha feature introduced in Kubernetes release 1.6. ● Extension points: ○ Node Controller: For checking the cloud provider to determine if a node has been deleted in the cloud after it stops responding ○ Route Controller: For setting up routes in the underlying cloud infrastructure ○ Service Controller: For creating, updating and deleting cloud provider load balancers ○ Volume Controller: For creating, attaching, and mounting volumes, and interacting with the cloud provider to orchestrate volumes https://kubernetes.io/docs/concepts/overview/components/
  • 16. kube-scheduler ● kube-scheduler watches newly created pods that have no node assigned, and selects a node for them to run on. https://kubernetes.io/docs/concepts/overview/components/
  • 17. DNS ● While the other addons are not strictly required, all Kubernetes clusters should have cluster DNS, as many examples rely on it. ● Cluster DNS is a DNS server, in addition to the other DNS server(s) in your environment, which serves DNS records for Kubernetes services. ● Containers started by Kubernetes automatically include this DNS server in their DNS searches. https://kubernetes.io/docs/concepts/overview/components/
  • 18. Overlay Network Options https://kubernetes.io/docs/concepts/cluster-administration/networking/ ● Cilium ● Contiv ● Contrail ● Flannel ● Google Compute Engine (GCE) ● Kube-router ● L2 networks and linux bridging ● Multus (a Multi Network plugin) ● NSX-T ● Nuage Networks VCS (Virtualized Cloud Services) ● OpenVSwitch ● OVN (Open Virtual Networking) ● Project Calico ● Romana ● Weave Net from Weaveworks ● CNI-Genie from Huawei
  • 20. Reference Architecture Overlay Network Pod 1 Pod 2 Service 1 Pod 3 Pod 4 Pod m Service n Deployments Load Balancer DB 1 DB 2 DB X Persistent Volumes HPAs Pod Security Policies Ingresses Container Registry Node1 Node2 Noden Ingress Controller
  • 21. WSO2 Docker Images ● WSO2 Docker images are built using standard Dockerfiles ● Default base image used is Ubuntu Server LTS ● Will only include: ○ Oracle JDK 1.8 ○ JDBC Driver ○ Latest product distribution ○ Extensions, and Customizations ● Will not include: ○ Configurations (Passed via ConfigMaps) ○ Credentials (Passed via Secrets) ○ Deployable Artifacts (Passed via ConfigMaps)
  • 22. Container Orchestration ● Deployments will be used for container orchestration ● Deployments will create replca sets ● Replica sets will internally create pods ● Deployments will define health checks for autohealing ● Horizontal pod autoscalers (HPA) will be used for autoscaling https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ Pod 1 Pod 2 Service Deployments Container Registry
  • 23. Service Discovery ● Kubernetes services will be used for service discovery ● Each service will have a domain name ● WSO2 components will use services to talk to each other (inter-component communication) https://kubernetes.io/docs/concepts/services-networking/service/ Pod 1 Pod 2 Service 1 Pod 3 Pod 4 Service n
  • 24. Cluster Discovery ● Carbon clustering is required for some of the WSO2 components such as Analytics, CEP, and IS ● WSO2 Kubernetes membership scheme is used for auto discoverying members in the cluster via the Kubernetes API or DNS Pod 1 Pod 2 Service 1 Pod 2 Kubernetes API DNS
  • 25. Runtime Artifact Synchronization ● WSO2 components such as Integrator, BPS, API Gateway would require synchronizing runtime artifacts ● The recommended approach for this is to use a Network File System (NFS) and share the repository/deployment/server folder of pods via a persistent volume https://kubernetes.io/docs/concepts/storage/persistent-volumes/ Pod 1 Pod 2 Service Persistent Volume Pod n
  • 26. Configuration Management ● Each configuration folder will be converted in to a ConfigMap and passed in to the pod using a volume mount ● This approach makes the configuration update process simpler ● Would not require to re-build the Docker images https://kubernetes.io/docs/concepts/storage/persistent-volumes/ Pod 1 Pod 2 Service VolumesConfigMaps
  • 27. Load Balancing ● Internal routing will use Kubernetes services. ● External routing will use a load balancer ● Ingress definitions will be used to automatically configure load balancers via Ingress controllers. ● If required standard load balancers can also be used with manual configurations. https://kubernetes.io/docs/concepts/services-networking/ingress/ Pod 1 Pod 2 Service 1 Pod 3 Pod 4 Service n Load Balancer Ingresses Ingress Controller
  • 28. Autoscaling ● Autoscaling can be applied at two levels: ○ Pod autoscaling ○ Kubernetes cluster autoscaling ● Horizontal pod autoscalers (HPA) will be used for autoscaling pods. ● Kubernetes cluster autoscaler will scale the number of Kubernetes nodes according to the number of pods being scheduled. https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ https://kubernetes.io/docs/tasks/administer-cluster/cluster-management/#cluster-autoscaling Pod 1 Pod n Service Deployments HPAs
  • 29. Kubernetes Package Management https://docs.helm.sh/ ● A chart is a collection of files that describe a related set of Kubernetes resources. ● A single chart might be used to deploy a simple pod or a complex application. ● WSO2 plans to implement charts for WSO2 middleware. ● Charts can be managed in Helm repositories.
  • 31. Security Best Practices ● Ensure container images are free of vulnerabilities ○ Implement continuous security vulnerability scanning ○ Regularly apply security updates ● Ensure that only authorized images are used in your environment ● Limit direct access to kubernetes nodes ● Create administrative boundaries between resources (using namespaces) ● Define resource quota for pods ● Implement network segmentation when necessary (using network policies) ● Log everything http://blog.kubernetes.io/2016/08/security-best-practices-kubernetes-deployment.html
  • 32. Container Security ● WSO2 containers use a nonroot user for starting the server processes ● The WSO2 server filesystem will only have required levels of persmissions in each directory ● Permissions to volume mounts will be granted via Pod Security Policies
  • 33. Pod Security Policies ● A Pod Security Policy is a cluster-level resource that controls the actions that a pod can perform and what it has the ability to access. https://kubernetes.io/docs/concepts/policy/pod-security-policy/
  • 34. Control Aspects of a Pod Security Policy https://kubernetes.io/docs/concepts/policy/pod-security-policy/ Control Aspect Field Name Running of privileged containers privileged Default set of capabilities that will be added to a container defaultAddCapabilities Capabilities that will be dropped from a container requiredDropCapabilities Capabilities a container can request to be added allowedCapabilities Controlling the usage of volume types volumes The use of host networking hostNetwork The use of host ports hostPorts The use of host’s PID namespace hostPID
  • 35. Control Aspects of a Pod Security Policy Cont. https://kubernetes.io/docs/concepts/policy/pod-security-policy/ Control Aspect Field Name The use of host’s IPC namespace hostIPC The SELinux context of the container seLinux The user ID runAsUser Configuring allowable supplemental groups supplementalGroups Allocating an FSGroup that owns the pod’s volumes fsGroup Requiring the use of a read only root file system readOnlyRootFilesystem Running of a container that allow privilege escalation from its parent allowPrivilegeEscalation Control whether a process can gain more privileges than its parent process defaultAllowPrivilegeEscalation
  • 37. WSO2 Update Manager (WUM) ● Use WUM for downloading latest WSO2 product distributions including bug and security fixes http://wso2.com/wum
  • 38. The Deployment Process WSO2 Product Distributions WSO2 Docker Images Version Control System Version Control System Configuaration Files Deployable Artifacts WSO2 Update Manager (WUM) Extensions Updates Updated WSO2 Product Distributions Customizations Oracle JDK JDBC Driver Container Registry ConfigMaps & Secrets WSO2 Kubernetes Resources KubernetesCluster WSO2 Docker Images
  • 40. Rolling Out Updates ● Execute a Kubernetes rollout for: ○ WSO2 product updates ○ WSO2 resource updates ○ Or WSO2 configuration changes which are backward compatible ● If the changes are not backward compatible: ○ Execute a blue/green deployment https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ #rolling-update-deployment
  • 42. Components to Monitor http://blog.kubernetes.io/2017/05/kubernetes-monitoring-guide.html Infrastructure Pods/Containers -> Monitored by Replica Sets WSO2 Servers -> Monitored by Deployment Health Checks Kubernetes Components
  • 45. Proposed Kubernetes Monitoring Architecture https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/ monitoring_architecture.md
  • 47. WSO2 Kubernetes Resources Currently available: ● https://github.com/wso2/kubernetes-common/ ● https://github.com/wso2/kubernetes-apim/ ● https://github.com/wso2/kubernetes-ei/ In progress: ● https://github.com/wso2/kubernetes-is/ ● https://github.com/wso2/kubernetes-das/ ● https://github.com/wso2/kubernetes-iot/