javantura v4 - self-service app deployment with kubernetes and openshift - marko lukša

20
SELF-SERVICE APP DEPLOYMENT WITH KUBERNETES AND OPENSHIFT A quick introduction to the two technologies Marko Luksa Software Engineer February 11, 2017

Category:

Technology


0 download

TRANSCRIPT

SELF-SERVICE APP DEPLOYMENTWITH KUBERNETES AND OPENSHIFT

A quick introduction to the two technologies

Marko LuksaSoftware EngineerFebruary 11, 2017

2

MARKO LUKSAAbout me

Software engineer at Red Hat, currently part of the Cloud Enablement team, bringing Red Hat’s Java Middleware products (EAP, Data Grid, Data Virtualization, etc.) to OpenShift.

● Programming since age 6, developing sw professionally for 20+ years● Various languages, 15+ years of Java● 5 years at Red Hat● CDI/Weld, CapeDwarf, some Infinispan contributions, Cloud Enablement● Just started working on Kubernetes Service Catalog● Author of Kubernetes in Action (Manning Publications, summer 2017)

3

THE OLD WAY OF DOING THINGSHow bringing software to production is like without Kubernetes & OpenShift

We’ve been doing it for so long, we don’t acknowledge these are really bad problems:

● Differences between dev and production environments● From development to production:

○ Developers hand over their WARs & JARs to ops, ○ Must always wait for sysadmins to get access, ○ Sysadmins don’t want to know the peculiarities of each app

● Deploy to the cloud? Portability / lock-in!● Bad hardware utilization● Need to scale easily to enable business growth

4

THE NEW WAY OF DOING THINGSJust do this and all your troubles will disappear

New tools and new ways of doing things help us fix the problems of yesterday.

● Containers● Container orchestration● Micro services● DevOps

○ But now developers are forced to know the hardware infrastructure● Continuous integration & delivery

5

CONTAINERSPortability, consistency, standardization

Containers help alleviate a lot of our problems:

● Consistent environment● Package the app + everything the app needs into a portable package● Store app in a central registry, access it from anywhere● Run on any Linux machine (prerequisite: container runtime)● Pack more apps onto a machine (100s of containers per host vs. just a few VMs)● Docker, rkt, Open Container Initiative● Do we need anything else?

6

7

KUBERNETESGreek for helmsman (person, who steers the ship) or pilot

Why is the whole world going crazy about k8s (k+ubernete(8 chars)+s)?

● Google! (Borg, Omega; doing it like this for more than a decade)● Open Source, big community, very fast adoption & devel. (core velocity problem)● Not just container orchestration● Abstracts away the infrastructure

○ Exposes tens/hundreds/thousands of nodes as a single deployment plane● Does the ops work for you

○ Scheduling, Self-healing, Autoscaling

8

KUBERNETES FEATURESMuch more than just container orchestration

Among other things, Kubernetes provides these features:

● Automatic bin packing● Horizontal scaling● Automated deployment rollouts and rollbacks● Self-healing● Service discovery and load balancing● Secret and configuration management● Storage orchestration● Batch execution

9

SELF-SERVICE APP DEPLOYMENTDevelopers can deploy apps without any help from the sysadmins

Once a sysadmin deploys Kubernetes on your servers, developers can start deploying applications on those servers without having to know anything about them.

● Developer doesn’t need to deal with individual machines● Developer doesn’t even need to know how many machines there are● Developer tells Kubernetes: “I want X copies of this app to be running”● Kubernetes finds the best spot to run the app (for each copy)● Service discovery enables client apps to find other apps they need● Sysadmins take care of Kubernetes, not the apps themselves

10

KUBERNETES ARCHITECTUREThe components that make up a Kubernetes cluster

Kubernetes components are split into two groups:

● Control plane (“master”)○ etcd (distributed key value store)○ Kubernetes API Server (REST) ○ Kubernetes Scheduler○ Kubernetes Controller Manager

● Nodes (“workers”)○ Container Runtime (Docker, rkt)○ Kubelet○ Kubernetes Proxy

11

INTERACTING WITH KUBERNETESUsers talk to the master; the master instructs nodes what to do

Kubernetes Master

myapp.yaml

1 x

5 x

2 x

10s or 1000s of worker nodes exposed as a single deployment platform

12

RUNNING AND MANAGING APPSHow applications are deployed and managed in Kubernetes

You tell Kubernetes what you want your system state to be and Kubernetes takes care of it.

● Declarative vs. imperative approach● Post JSON or YAML descriptors to the Kubernetes REST API server● Use kubectl command-line tool:

$ kubectl run <deploymentName> --image=<image> --replicas=3

$ kubectl expose deployment <deploymentName> --port=80 --target-port=8080

$ kubectl get pods,services,deployments

$ kubectl scale <deploymentName> --replicas=5

13

KUBERNETES CONCEPTSThe building blocks you use to run applications

Talking to Kubernetes entails creating objects through the Kubernetes API:

● Pods (one or more collocated containers)● Labels & label selectors● Replication controllers (ReplicaSet, DaemonSet, StatefulSet, Job, ScheduledJob)● Services● Volumes, PersistentVolumes● ConfigMaps, Secrets● Deployments

14

15

Red Hat OpenShift is a complete container application platform

RED HAT OPENSHIFTEnterprise Kubernetes

CODE BUILD DEPLOY

16

RED HAT OPENSHIFTRed Hat’s Container Application Platform

Red Hat OpenShift is an open-source Platform-as-a-Service built on top of Kubernetes.

● Not just run, but also build apps● Don’t need to deal with Docker (sort of)● Enterprise-grade container platform● Origin, OCP, Dedicated, Online● Suite of templates and container images with S2I capability

○ JBoss Enterprise Application Platform○ JBoss Data Grid○ ...

17

ADDITIONAL CONCEPTS IN OPENSHIFTAdditional API objects only available in OpenShift

OpenShift brings the following additional objects on top of what Kubernetes offers:

● Users and Security Policies● Templates● BuildConfig● DeploymentConfig (similar to Deployment in Kubernetes)● Routes (similar to Ingress in Kubernetes)● ...

18

DEMOLet’s see OpenShift in action

We’re going to show the following:

● Build and deploy a Java EE Enterprise Application in JBoss EAP (inside OpenShift)● Horizontally scale up to three instances (three running EAP servers)● Simulate node going down (by deleting a pod)● Modify the app and perform a rolling update● Scale back down to 1 EAP instance● Clean up everything

19

Learn how to develop and run self-healing apps with Kubernetes.

● Early access: first half of book already available● Estimated publication date: Summer 2017● www.manning.com/books/kubernetes-in-action● 40% off all Manning books for Javantura attendees:

○ Use code ctwjavantura at manning.com

“KUBERNETES IN ACTION” BOOKMarko Luksa (Manning Publications, 2017)

THANK YOU

plus.google.com/+RedHat

linkedin.com/company/red-hat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/markoluksa

[email protected]● twitter.com/markoluksa● medium.com/@marko.luksa