-
Provide a light-weight virtualization solution
-
Through the use of Linux kernel features -
-
cgroups
to share/limit hardware resources -
namespaces
to provide isolation
-
-
without requiring a guest OS
Docker is a shipping container system for code. Consists of -
-
A portable, lightweight runtime and packaging tool (Docker Engine)
-
A cloud service for sharing applications and automating workflows (Docker Hub)
-
Run a Java EE app in a Docker container
docker run -d -p 8080:8080 vineetreynolds/badwildflycluster
-
Run the same image in another Docker container
docker run -d -p 9080:8080 vineetreynolds/badwildflycluster
-
First, node discovery
-
JBoss EAP handles this with JGroups
-
JGroups ensures nodes are discovered
-
Solutions will be similar for other application servers
-
-
Then, replicate state to handle failover
-
JBoss EAP handles this with Infinispan
-
Infinispan ensures atleast one replica for shared data
-
docker run -d -p 8080:8080 vineetreynolds/wildflycluster
docker run -d -p 9080:8080 vineetreynolds/wildflycluster
-
Use database containers
-
Store the data on volumes mounted on the host
-
-
Link database containers to application servers
-
Exposes database info to linked containers for usage
-
Example:
docker run --name mysqldb -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_DATABASE=sample -e MYSQL_ROOT_PASSWORD=supersecret -d mysql
docker run --name mywildfly --link mysqldb:db -p 8080:8080 -d vineetreynolds/wildflycluster
-
Supports runtime and operational management of containers
-
Describes the intended state of the cluster
-
Record links between containers - 'frontend' depends on 'backend'
-
Replicate containers onto the desired number of nodes; 'frontend' should always run on X nodes, 'backend' should run only on 1 node
-
-
Provides self-healing capabilities to repair the cluster to intended state
-
Solves the Cluster Container Management problem
-
the substrate for running containers at scale
-
contains just the runtime and operational tools for containers
-
Composable system - only enough to enable other use cases
-
-
Fundamental unit in the system
-
Pod is a group of related containers on the same system
-
Each container can be its own image with its own env
-
Pods share an IP address and data volumes
-
-
Pods are "transient"
-
Pods should be able to be deleted at any time
-
Storage can be detached and reattached elsewhere
-
Different pods talk to each other through abstractions
-
-
Single container - JBoss, MySQL etc.
-
Web server and log parser (one pod, two containers)
-
Web server container logs HTTP requests to disk
-
Log parser reads from disk and sends summary info elsewhere
-
-
Abstract a set of pods as a single IP and port
-
Each host has a proxy that knows where other pods are
-
Simple TCP/UDP load balancing
-
No central load balancer (no SPOF)
-
-
Creates environment variables in other pods
-
Like "docker link", but across hosts
-
Service named "mysql" gets
MYSQL_HOST
andMYSQL_PORT
-
-
Replication controllers allow running multiple pods on multiple minions
-
Define the number of pods in the intended state
-
Kubernetes takes care of replicating the pods
....
"podTemplate": {
"desiredState": {
"manifest": {
"id": "wildfly",
"version": "v1beta1",
"containers": [
{
"image": "vineetreynolds/wildflycluster",
"name": "wildfly-container",
....
How many replicas?
....
"desiredState": {
"replicas": 2,
"replicaSelector": {
"name": "wildfly"
},
....
-
External access to the cluster
-
Pods are transient, and therefore …
-
Update external load balancers or edge routers with updated cluster state
-
What should be done -
-
when a container goes down ? Notify the load balancer
-
when a container is added ? Notify the load balancer
-
-
Cloud providers solve this out of the box - GCE/OpenShift
-
Refer the
createExternalLoadBalancer
flag for Kube services
-
-
Applications experience peaks and valleys in usage
-
Operators scale up resources on demand
-
Currently, a feature in progress in Kubernetes
-
Resource scaling will be driven by data from input sources
-
Scope is horizontal scaling for now
-
Scaling based on traffic
-
Scaling based on predictive analysis
-
Scaling based on arbitrary data points - job execution time, number of sessions etc.