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

Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

Jan 22, 2018

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

SELF-SERVICE APP DEPLOYMENTWITH KUBERNETES AND OPENSHIFT

A quick introduction to the two technologies

Marko LuksaSoftware EngineerFebruary 11, 2017

Page 2: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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)

Page 3: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 4: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 5: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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?

Page 6: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

6

Page 7: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 8: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 9: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 10: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 11: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 12: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 13: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 14: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

14

Page 15: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

15

Red Hat OpenShift is a complete container application platform

RED HAT OPENSHIFTEnterprise Kubernetes

CODE BUILD DEPLOY

Page 16: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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○ ...

Page 17: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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)● ...

Page 18: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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

Page 19: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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)

Page 20: Javantura v4 - Self-service app deployment with Kubernetes and OpenShift - Marko Lukša

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