SlideShare a Scribd company logo
1 of 26
Download to read offline
Docker, Kubernetes & Jube
Build, containerize & orchestrate
Marko Lukša & Aleš Justin, Red Hat
mluksa@redhat.com
ajustin@redhat.com
Docker
● Platform for building, distributing and running
applications
● Lightweight container “virtualization”
● 10s of VMs => 100s, 1000s of containers per host
Docker concepts
● Images
○ A read-only package of an app & environment
○ Consists of Layers (some layers shared by images)
● Registries
○ Pull images from & push images to registry
○ Private & public registries (Docker Hub)
● Containers
○ A running image (“Process in a box”)
○ Read-Write layer on top of base image
Docker layers
Creating Docker images
● Use existing image (e.g. fedora, jboss/wildfly)
● Run a command (anything, even a shell)
○ Docker creates a new container from image
○ Allocates a read-write layer on top of image
○ Executes the command
● Run additional commands
● Look up last container id
● Commit the container as new image
Dockerfile
● Build an image automatically
● Specifies base image and instructions:
○ FROM <existing image>
○ ADD <local file> <path inside image>
○ RUN <cmd>
○ EXPOSE <port>
○ ENV <name> <value>
○ CMD <cmd>
Dockerfile - example
# Use latest jboss/base-jdk:7 image as the base
FROM jboss/base-jdk:7
# Set the WILDFLY_VERSION env variable
ENV WILDFLY_VERSION 8.2.0.Final
# Add the WildFly distribution to /opt
RUN cd $HOME && curl http://download.jboss.
org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz | tar zx && mv
$HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly
# Set the JBOSS_HOME env variable
ENV JBOSS_HOME /opt/jboss/wildfly
# Expose the ports we're interested in
EXPOSE 8080 9990
# Set the default command to run on boot
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
Kubernetes
● Orchestration system for Docker containers
● Provides basic mechanisms for:
○ deployment
○ maintenance
○ scaling
● Auto-restarting, re-scheduling & replicating
containers
Kubernetes architecture
● Master node
○ etcd (distributed key value store)
○ Kubernetes API Server (REST) (+ Scheduler)
○ Kubernetes Controller Manager Server
● Minions
○ Docker
○ Kubelet
○ Kubernetes Proxy
Kubernetes concepts
● Pods
● Volumes
● Labels
● Replication controllers
● Services
apiVersion: v1beta1
id: www
desiredState:
manifest:
version: v1beta1
id: X
containers:
- name: nginx
image: dockerfile/nginx
- name: mydb
image: foo/mycooldb
Pods
Minion (Host) 1
A
Pod X
B
● Resource sharing &
communication
● Not fully isolated
● Scheduled to a node
● Containers are auto-
restarted
● If a node dies, its
pods are deleted (not
rescheduled)
Pods (continued)
Minion (Host) 1
A
Pod X
B
desiredState: manifest:
containers:
- name: A
image: foo/A
volumeMounts:
- name: vol1
mountPath: /data/vol1
volumes:
- name: vol1
source:
emptyDir: {}
Or:
hostDir: /opt/data/vol1
Volumes
Minion (Host) 1
A
Pod X
B
Vol 1
● key-value pairs
● for categorizing things
“env”:”dev”, “env”:”prod”, “env”:”qa”
“rel”:”stable”, “rel”:”canary”
“partition”:”custA”, “partition”:”custB”
● label selectors
Labels
Minion (Host) 1
A
Pod X
B
Vol 1
“name”: “podX”,
“env”: “dev”
id: replicationControllerY
kind: ReplicationController
desiredState:
replicas: 2
replicaSelector:
env: prod
rel: stable
podTemplate:
desiredState:
manifest:
...
labels:
- env: prod
- rel: stable
Replication controllers
Minion (Host) 1
A
Pod X
Minion 2
Replication controller Y
(replicas: 2, podTemplate, replicaSelector:
{“env”:”prod”, “rel”:”stable”})
B
Vol 1
“name”: “podX”,
“env”: “dev”
C
D
Pod Y1
“env”: “prod”,
“rel”: “stable”
C
D
Pod Y2
“env”: “prod”,
“rel”: “stable”
id: myApp
kind: Service
apiVersion: v1beta1
port: 1234
selector:
env: prod
containerPort: 2345
Services
Minion (Host) 1
A
Pod X
Minion 2
Replication controller Y
(replicas: 2, podTemplate, replicaSelector:
{“env”:”prod”, “rel”:”stable”})
B
Vol 1
“name”: “podX”,
“env”: “dev”
C
D
Pod Y1
“env”: “prod”,
“rel”: “stable”
C
D
Pod Y2
“env”: “prod”,
“rel”: “stable”
myApp (selector: {env:prod})
● Env vars:
MYAPP_SERVICE_HOST,
MYAPP_SERVICE_PORT
● future: DNS
● New replication
controller (rel:canary)
● stable controller:
replicas--
● canary controller:
replicas++
Canary releases
Minion (Host) 1
A
Pod X
Minion 2
Replication controller Y
(replicas: 1, podTemplate, replicaSelector:
{“env”:”prod”, “rel”:”stable”})
B
Vol 1
“name”: “podX”,
“env”: “dev”
Replication controller Y’
(replicas: 1, podTemplate, replicaSelector:
{“env”:”prod”, “rel”:”canary”})
C
D
Pod Y1
“env”: “prod”,
“rel”: “stable”
myApp (selector: {env:prod})
“env”: “prod”,
“rel”: “stable”
C
D
Pod Y2
C’
D’
Pod Y’1
“env”: “prod”,
“rel”: “canary”
● labels of a running
pod can be changed
● way of adding or
removing pods from
services or replication
controllers
Debug pods
Minion (Host) 1
A
Pod X
Minion 2
Replication controller Y
(replicas: 2, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”stable”})
B
Vol 1
“name”: “podX”,
“env”: “dev”
C
D
Pod Y1
“env”: “prod”,
“rel”: “stable”
myApp (selector: {env:prod})
“env”: “prod”,
“rel”: “stable”
C
D
Pod Y2
C
D
Pod Y3
“env”: “prod”,
“rel”: “stable”
“env”: “debug”,
“rel”: “stable”
OpenShift v3
● Platform-As-A-Service
● Kubernetes extensions
○ Application Templates
■ Single JSON file for configuring Kube resources
■ Parameterizable (see example)
○ Builds
■ Hosts source code in git repos
■ Performs builds and hosts private docker images
■ Kick off new builds on git-push
OpenShift v3 - Fabric8
● Fabric8 v2
○ Aggregate logging
■ LogSpout, LogStash, Fluentd, Elastic, Kibana
○ Aggregate metrics
■ kAdvisor, InfluxDB, Grafana
○ Auto-scaling
■ Should be in K8s …
■ AScaler
OpenShift v3 - EAP
● EAP
○ KubePing
○ CE Arquillian
What is Jube?
● Issues ...
○ I’m not using Linux
■ env switching pita
○ I want to debug my app
■ local vs. remote
○ Everything is a Docker image
■ I just want to use my (Java) app
What is Jube?
● Solution?
○ Java based Kubernetes mock
○ It’s all about Kubernetes REST API
■ And similar Kubernetes-like behavior
● Replication, master election, ...
● Where is Docker?
○ Nope, no Docker here
■ Zip images
■ Lifecycle scripts
Demo (ping us after presentation ;-)
● Jube
● Fabric8
● Hawtio
● WildFly
● Cluster
● Hello servlet
Resources
● https://github.com/jubeio/jube
● http://fabric8.io/
● https://github.com/hawtio/hawtio
● http://www.wildfly.org
Resources
● https://www.docker.com/
● https://www.docker.com/tryit/
● https://registry.hub.docker.com/
● http://kubernetes.io/
● https://github.com/GoogleCloudPlatform/kubernetes
● https://godoc.org/github.com/GoogleCloudPlatform/kubernetes/pkg/api
● https://github.com/openshift/origin
● https://blog.openshift.com/openshift-v3-deep-dive-docker-kubernetes/

More Related Content

What's hot

Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Docker, Inc.
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Nicolas De Loof
 
Service discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenService discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenJ On The Beach
 
Using linuxKit to build custom rancherOS systems
Using linuxKit to build custom rancherOS systems Using linuxKit to build custom rancherOS systems
Using linuxKit to build custom rancherOS systems Moby Project
 
Docker session IV: Docker Compose and Docker Swarm
Docker session IV: Docker Compose and Docker SwarmDocker session IV: Docker Compose and Docker Swarm
Docker session IV: Docker Compose and Docker SwarmDegendra Sivakoti
 
Docker Fundamentals
Docker FundamentalsDocker Fundamentals
Docker FundamentalsMien Dinh
 
Wanting distributed volumes - Experiences with ceph-docker
Wanting distributed volumes - Experiences with ceph-dockerWanting distributed volumes - Experiences with ceph-docker
Wanting distributed volumes - Experiences with ceph-dockerEwout Prangsma
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmMario IC
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetesTed Jung
 
Containerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael CrosbyContainerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael CrosbyDocker, Inc.
 
LinuxKit Swarm Nodes
LinuxKit Swarm NodesLinuxKit Swarm Nodes
LinuxKit Swarm NodesMoby Project
 
CoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in UtrechtCoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in UtrechtTimo Derstappen
 

What's hot (20)

CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
CoreOS Overview
CoreOS OverviewCoreOS Overview
CoreOS Overview
 
Docker n co
Docker n coDocker n co
Docker n co
 
Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane Monitoring Containers at New Relic by Sean Kane
Monitoring Containers at New Relic by Sean Kane
 
CoreOS Intro
CoreOS IntroCoreOS Intro
CoreOS Intro
 
Docker up and running
Docker up and runningDocker up and running
Docker up and running
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
 
Docker Overview
Docker OverviewDocker Overview
Docker Overview
 
Service discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel GuillenService discovery in mesos miguel, Angel Guillen
Service discovery in mesos miguel, Angel Guillen
 
Using linuxKit to build custom rancherOS systems
Using linuxKit to build custom rancherOS systems Using linuxKit to build custom rancherOS systems
Using linuxKit to build custom rancherOS systems
 
Docker session IV: Docker Compose and Docker Swarm
Docker session IV: Docker Compose and Docker SwarmDocker session IV: Docker Compose and Docker Swarm
Docker session IV: Docker Compose and Docker Swarm
 
Docker Fundamentals
Docker FundamentalsDocker Fundamentals
Docker Fundamentals
 
Wanting distributed volumes - Experiences with ceph-docker
Wanting distributed volumes - Experiences with ceph-dockerWanting distributed volumes - Experiences with ceph-docker
Wanting distributed volumes - Experiences with ceph-docker
 
Docker Compose to Production with Docker Swarm
Docker Compose to Production with Docker SwarmDocker Compose to Production with Docker Swarm
Docker Compose to Production with Docker Swarm
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Container & kubernetes
Container & kubernetesContainer & kubernetes
Container & kubernetes
 
Containerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael CrosbyContainerd: Building a Container Supervisor by Michael Crosby
Containerd: Building a Container Supervisor by Michael Crosby
 
LinuxKit Swarm Nodes
LinuxKit Swarm NodesLinuxKit Swarm Nodes
LinuxKit Swarm Nodes
 
CoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in UtrechtCoreOS @ summer meetup in Utrecht
CoreOS @ summer meetup in Utrecht
 
Docker and CloudStack
Docker and CloudStackDocker and CloudStack
Docker and CloudStack
 

Viewers also liked

DevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyDevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyCA Technologies
 
Apache Stratos 4.1.0 Architecture
Apache Stratos 4.1.0 ArchitectureApache Stratos 4.1.0 Architecture
Apache Stratos 4.1.0 ArchitectureImesh Gunaratne
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Kubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupKubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupMist.io
 
Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...Murat Mukhtarov
 
Kubernetes Architecture v1.x
Kubernetes Architecture v1.xKubernetes Architecture v1.x
Kubernetes Architecture v1.xYongbok Kim
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Christian Posta
 
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO DevOps with ActiveMQ, Camel, Fabric8, and HawtIO
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO Christian Posta
 

Viewers also liked (9)

Geode on Docker
Geode on DockerGeode on Docker
Geode on Docker
 
DevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than TechnologyDevOps: A Culture Transformation, More than Technology
DevOps: A Culture Transformation, More than Technology
 
Apache Stratos 4.1.0 Architecture
Apache Stratos 4.1.0 ArchitectureApache Stratos 4.1.0 Architecture
Apache Stratos 4.1.0 Architecture
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Kubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetupKubernetes and CoreOS @ Athens Docker meetup
Kubernetes and CoreOS @ Athens Docker meetup
 
Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...
 
Kubernetes Architecture v1.x
Kubernetes Architecture v1.xKubernetes Architecture v1.x
Kubernetes Architecture v1.x
 
Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO DevOps with ActiveMQ, Camel, Fabric8, and HawtIO
DevOps with ActiveMQ, Camel, Fabric8, and HawtIO
 

Similar to JavaCro'15 - Docker, Kubernetes and Jube - a new cloud architecture - Aleš Justin, Marko Lukša

Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfGetting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfssuser348b1c
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkJérôme Petazzoni
 
Swarm: Native Docker Clustering
Swarm: Native Docker ClusteringSwarm: Native Docker Clustering
Swarm: Native Docker ClusteringRoyee Tager
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniTheFamily
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionJérôme Petazzoni
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceMarco Pas
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Jérôme Petazzoni
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleAmir Moghimi
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetesLiran Cohen
 
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013dotCloud
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryDocker, Inc.
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 introTerry Cho
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesAkihiro Suda
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeDr. Ketan Parmar
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyJérôme Petazzoni
 
Orchestrating Docker with OpenStack
Orchestrating Docker with OpenStackOrchestrating Docker with OpenStack
Orchestrating Docker with OpenStackErica Windisch
 
Pdf tech deep dive 42 paris
Pdf tech deep dive 42 parisPdf tech deep dive 42 paris
Pdf tech deep dive 42 parisLaure Vergeron
 

Similar to JavaCro'15 - Docker, Kubernetes and Jube - a new cloud architecture - Aleš Justin, Marko Lukša (20)

Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdfGetting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
Getting-Started-with-Containers-and-Kubernetes_-March-2020-CNCF-Webinar.pdf
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New York
 
Swarm: Native Docker Clustering
Swarm: Native Docker ClusteringSwarm: Native Docker Clustering
Swarm: Native Docker Clustering
 
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container Service
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battle
 
Scaling docker with kubernetes
Scaling docker with kubernetesScaling docker with kubernetes
Scaling docker with kubernetes
 
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013
 
LXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software DeliveryLXC Docker and the Future of Software Delivery
LXC Docker and the Future of Software Delivery
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange County
 
Orchestrating Docker with OpenStack
Orchestrating Docker with OpenStackOrchestrating Docker with OpenStack
Orchestrating Docker with OpenStack
 
Pdf tech deep dive 42 paris
Pdf tech deep dive 42 parisPdf tech deep dive 42 paris
Pdf tech deep dive 42 paris
 

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association (20)

Java cro'21 the best tools for java developers in 2021 - hujak
Java cro'21   the best tools for java developers in 2021 - hujakJava cro'21   the best tools for java developers in 2021 - hujak
Java cro'21 the best tools for java developers in 2021 - hujak
 
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK KeynoteJavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
 
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan LozićJavantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
 
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
 
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
 
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
 
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander RadovanJavantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
 
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
 
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
 
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
 
Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...
 
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej VidakovićJavantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
 
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
 
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
 
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
 
Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...
 
Javantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela PetracJavantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela Petrac
 
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje RuhekJavantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
 
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
 
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario KusekJavantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
 

JavaCro'15 - Docker, Kubernetes and Jube - a new cloud architecture - Aleš Justin, Marko Lukša

  • 1. Docker, Kubernetes & Jube Build, containerize & orchestrate Marko Lukša & Aleš Justin, Red Hat mluksa@redhat.com ajustin@redhat.com
  • 2. Docker ● Platform for building, distributing and running applications ● Lightweight container “virtualization” ● 10s of VMs => 100s, 1000s of containers per host
  • 3. Docker concepts ● Images ○ A read-only package of an app & environment ○ Consists of Layers (some layers shared by images) ● Registries ○ Pull images from & push images to registry ○ Private & public registries (Docker Hub) ● Containers ○ A running image (“Process in a box”) ○ Read-Write layer on top of base image
  • 5. Creating Docker images ● Use existing image (e.g. fedora, jboss/wildfly) ● Run a command (anything, even a shell) ○ Docker creates a new container from image ○ Allocates a read-write layer on top of image ○ Executes the command ● Run additional commands ● Look up last container id ● Commit the container as new image
  • 6. Dockerfile ● Build an image automatically ● Specifies base image and instructions: ○ FROM <existing image> ○ ADD <local file> <path inside image> ○ RUN <cmd> ○ EXPOSE <port> ○ ENV <name> <value> ○ CMD <cmd>
  • 7. Dockerfile - example # Use latest jboss/base-jdk:7 image as the base FROM jboss/base-jdk:7 # Set the WILDFLY_VERSION env variable ENV WILDFLY_VERSION 8.2.0.Final # Add the WildFly distribution to /opt RUN cd $HOME && curl http://download.jboss. org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz | tar zx && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly # Set the JBOSS_HOME env variable ENV JBOSS_HOME /opt/jboss/wildfly # Expose the ports we're interested in EXPOSE 8080 9990 # Set the default command to run on boot CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0"]
  • 8. Kubernetes ● Orchestration system for Docker containers ● Provides basic mechanisms for: ○ deployment ○ maintenance ○ scaling ● Auto-restarting, re-scheduling & replicating containers
  • 9. Kubernetes architecture ● Master node ○ etcd (distributed key value store) ○ Kubernetes API Server (REST) (+ Scheduler) ○ Kubernetes Controller Manager Server ● Minions ○ Docker ○ Kubelet ○ Kubernetes Proxy
  • 10. Kubernetes concepts ● Pods ● Volumes ● Labels ● Replication controllers ● Services
  • 11. apiVersion: v1beta1 id: www desiredState: manifest: version: v1beta1 id: X containers: - name: nginx image: dockerfile/nginx - name: mydb image: foo/mycooldb Pods Minion (Host) 1 A Pod X B
  • 12. ● Resource sharing & communication ● Not fully isolated ● Scheduled to a node ● Containers are auto- restarted ● If a node dies, its pods are deleted (not rescheduled) Pods (continued) Minion (Host) 1 A Pod X B
  • 13. desiredState: manifest: containers: - name: A image: foo/A volumeMounts: - name: vol1 mountPath: /data/vol1 volumes: - name: vol1 source: emptyDir: {} Or: hostDir: /opt/data/vol1 Volumes Minion (Host) 1 A Pod X B Vol 1
  • 14. ● key-value pairs ● for categorizing things “env”:”dev”, “env”:”prod”, “env”:”qa” “rel”:”stable”, “rel”:”canary” “partition”:”custA”, “partition”:”custB” ● label selectors Labels Minion (Host) 1 A Pod X B Vol 1 “name”: “podX”, “env”: “dev”
  • 15. id: replicationControllerY kind: ReplicationController desiredState: replicas: 2 replicaSelector: env: prod rel: stable podTemplate: desiredState: manifest: ... labels: - env: prod - rel: stable Replication controllers Minion (Host) 1 A Pod X Minion 2 Replication controller Y (replicas: 2, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”stable”}) B Vol 1 “name”: “podX”, “env”: “dev” C D Pod Y1 “env”: “prod”, “rel”: “stable” C D Pod Y2 “env”: “prod”, “rel”: “stable”
  • 16. id: myApp kind: Service apiVersion: v1beta1 port: 1234 selector: env: prod containerPort: 2345 Services Minion (Host) 1 A Pod X Minion 2 Replication controller Y (replicas: 2, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”stable”}) B Vol 1 “name”: “podX”, “env”: “dev” C D Pod Y1 “env”: “prod”, “rel”: “stable” C D Pod Y2 “env”: “prod”, “rel”: “stable” myApp (selector: {env:prod}) ● Env vars: MYAPP_SERVICE_HOST, MYAPP_SERVICE_PORT ● future: DNS
  • 17. ● New replication controller (rel:canary) ● stable controller: replicas-- ● canary controller: replicas++ Canary releases Minion (Host) 1 A Pod X Minion 2 Replication controller Y (replicas: 1, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”stable”}) B Vol 1 “name”: “podX”, “env”: “dev” Replication controller Y’ (replicas: 1, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”canary”}) C D Pod Y1 “env”: “prod”, “rel”: “stable” myApp (selector: {env:prod}) “env”: “prod”, “rel”: “stable” C D Pod Y2 C’ D’ Pod Y’1 “env”: “prod”, “rel”: “canary”
  • 18. ● labels of a running pod can be changed ● way of adding or removing pods from services or replication controllers Debug pods Minion (Host) 1 A Pod X Minion 2 Replication controller Y (replicas: 2, podTemplate, replicaSelector: {“env”:”prod”, “rel”:”stable”}) B Vol 1 “name”: “podX”, “env”: “dev” C D Pod Y1 “env”: “prod”, “rel”: “stable” myApp (selector: {env:prod}) “env”: “prod”, “rel”: “stable” C D Pod Y2 C D Pod Y3 “env”: “prod”, “rel”: “stable” “env”: “debug”, “rel”: “stable”
  • 19. OpenShift v3 ● Platform-As-A-Service ● Kubernetes extensions ○ Application Templates ■ Single JSON file for configuring Kube resources ■ Parameterizable (see example) ○ Builds ■ Hosts source code in git repos ■ Performs builds and hosts private docker images ■ Kick off new builds on git-push
  • 20. OpenShift v3 - Fabric8 ● Fabric8 v2 ○ Aggregate logging ■ LogSpout, LogStash, Fluentd, Elastic, Kibana ○ Aggregate metrics ■ kAdvisor, InfluxDB, Grafana ○ Auto-scaling ■ Should be in K8s … ■ AScaler
  • 21. OpenShift v3 - EAP ● EAP ○ KubePing ○ CE Arquillian
  • 22. What is Jube? ● Issues ... ○ I’m not using Linux ■ env switching pita ○ I want to debug my app ■ local vs. remote ○ Everything is a Docker image ■ I just want to use my (Java) app
  • 23. What is Jube? ● Solution? ○ Java based Kubernetes mock ○ It’s all about Kubernetes REST API ■ And similar Kubernetes-like behavior ● Replication, master election, ... ● Where is Docker? ○ Nope, no Docker here ■ Zip images ■ Lifecycle scripts
  • 24. Demo (ping us after presentation ;-) ● Jube ● Fabric8 ● Hawtio ● WildFly ● Cluster ● Hello servlet
  • 25. Resources ● https://github.com/jubeio/jube ● http://fabric8.io/ ● https://github.com/hawtio/hawtio ● http://www.wildfly.org
  • 26. Resources ● https://www.docker.com/ ● https://www.docker.com/tryit/ ● https://registry.hub.docker.com/ ● http://kubernetes.io/ ● https://github.com/GoogleCloudPlatform/kubernetes ● https://godoc.org/github.com/GoogleCloudPlatform/kubernetes/pkg/api ● https://github.com/openshift/origin ● https://blog.openshift.com/openshift-v3-deep-dive-docker-kubernetes/