Upload
henryk-konsek
View
534
Download
1
Embed Size (px)
Citation preview
Brought to you by Henryk Konsek
Containerize!Between Docker and Jube
@hekonsek
● Docker● Kubernetes● OpenShift● Fabric8● Jube
This talk
Server for running and managing Linux containers.
What is...
Operating-system-level virtualization.
What are Linux containers?
chroot on steroids + some kernel magic
What are Linux containers?
● slooooooow● gigantic images ● aggressive resource allocation ● bad API
Why not regular virtualization?
Container is the running image.
Key concepts
● image (immutable, no state)● container (mutable, has state)
Container is the running image.
Key concepts
Archived filesystem + metadata.
Docker image
Commands.
Docker awesomeness #1
Layers.
Docker awesomeness #2
WAR
Tomcat
JRE
Ubuntu base
Registries.
Docker awesomeness #3
Build once. Deploy everywhere!
Docker awesomeness #4
Immutable deployment. Use ENV variable to the container.
Docker awesomeness #4
“Recipes” for the new images.
Dockerfiles
FROM ubuntuEXPOSE 8080RUN apt-get install javaRUN mkdir /jarsADD target/app.jar /jars/CMD ["java", "-jar", "/jars/app.jar"]]
Create the new image
$ docker build -t com.me/app:1.0 .$ docker run -t com.me/app:1.0]
Let’s create the production-grade container!
Demo!
FROM ubuntuRUN apt-get update -qqyRUN apt-get install -qqy cowsayENTRYPOINT ["/usr/games/cowsay"]CMD ["Hello Docker!"]
Docker Maven plugin by Roland ‘Jolokia’ Huß
How can I put a fresh jar into an image?
How can I put a fresh jar into an image?
<image> <name>${project.artifactId}:${project.version}</name> <build> <from>hekonsek/fatjar:0.0.10-SNAPSHOT</from> <assemblyDescriptorRef>artifact</assemblyDescriptorRef> <exportDir>/jars</exportDir> </build> </image>
mvn docker:buid docker:push
Provided by the database community/vendor.
How can I get database image?
docker run -d -p 27017:27017 --name mongo mongo]
Yes. That’s all I can say ;) .
Any Red Hat customers using Docker in production?
The platform to scale Docker horizontally.
Kubernetes
by...
You can start many containers with your server Docker.
Why scale Docker?
But at some point you have to add more physical machines.
Why scale Docker?
Now networking between these containers becomes a challenge :( .
Why scale Docker?
High availability - single Docker server is SPOF.
Why scale Docker?
Helps you to keep your scaled Docker stuff together.
Kubernetes
Install and admin it yourself. Or...
Where can I find Kubernetes?
Where can I find Kubernetes?
- Red Hat Atomic- Red Hat Linux 7.1- CoreOS Linux- OpenShift 3- GKE (Google Container Engine)- Microsoft Azure- All the major cloud providers (soon)
- REST API- etcd key/value store- controller manager server
Kubernetes architecture - master node
- Docker server- kubelet- network proxy
Kubernetes architecture - minion node
Groups of containers running at the same physical machine.
Pod - unit of deployment
Kubernetes guarantees all or nothing deployment and execution of pods.
Pod - atomic unit of deployment
All containers within the pod can access the same volumes.
Pod nodes == shared disk
Pods uses direct connections for the intra-pod communication.
Pod - internal communication
Pods use network proxy for the inter-pod communication.
Pod - external communication
The network proxy
Guarantees N-instances of pods running at the same time.
Replication controller
Starts missing instances of the pods.
Replication controller
Performs health checks. Can kill and restart failing nodes.
Replication controller
In the Kubernetes world, starting the server is not human responsibility anymore! How cool is that?
Replication controller
The typical micoservices developer.
Services
Can we do better than Eureka?
How to discover the service?
Try to imagine something simpler.
Services coordinates == environment variables
String host = System.getenv("MONGO_SERVICE_DB_HOST");String port = System.getenv("MONGO_SERVICE_DB_PORT");Mongo mongo = new Mongo(host, Integer.parseInt(port));
Kubernetes + something extra.
OpenShift 3 == Cool PaaS
- Enterprise (private cloud)- On-Line (public cloud)- Origin (community project)
OpenShift 3 types
You can install OS Origin on your local machine as a Docker container.
OpenShift 3
- access external services using single URL- HAproxy instance bound to the services- TLS/SSL scope rules
OpenShift 3 - routing
Local (docker-based) cloud + Docker images + Kubernetes =smooth transition from dev to the production
OpenShift 3
OpenShift provides user groups based on the Kubernetes namespaces.
Multi-tenancy
OpenShift comes with the CI server that can build and deploy the containers for you.
Build & deploy pipeline
Off-the-shelf microservices!
OpenShift marketplace
Dev (and Ops) extras on the top of the Kubernetes.
Fabric8
Base examples you can use as templates for docker containers.
Value added by Fabric8 - quickstarts
Maven plugins making it easier to deploy Docker images into Kubernetes.
Value added by Fabric8 - developer tooling
Value added by Fabric8 - centralized logging
- CDI extension for Kubernetes- Kubernetes API client for Java- Spring Boot Kubernetes integration- Kubernetes JUnit goodies
Value added by Fabric8 - extra libraries
Value added by Fabric8 - fancy web UI
Pure-Java implementation of the Kubernetes API (no Docker here!)
Jube
Why Jube?
- your VPS doesn’t support Docker- your operating system doesn’t support Docker/Kubernetes- you’re not operational ready to go into the production with
Docker
Jube architecture
Demo!
CowSay and MongoDB in Kubernetes. How cool is that?