Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JavaOne 2016: Kubernetes introduction for Java Developers

142 views

Published on

Presentation with Edson Yanaga. Latest online version: http://bit.ly/kubernetes-intro

Published in: Technology
  • Be the first to comment

JavaOne 2016: Kubernetes introduction for Java Developers

  1. 1. 1 Kubernetes Introduction Rafael Benevides & Edson Yanaga benevides@redhat.com / yanaga@redhat.com @rafabene / @yanaga http://bit.ly/kubernetes-intro
  2. 2. Rafael Benevides Director of Developer Experience at Red Hat Apache DeltaSpike P.M.C benevides@redhat.com @rafabene Java Certifications: SCJA / SCJP / SCWCD / SCBCD / SCEA JBoss Certifications: JBCD / JBCAA Red Hat Certifications: OpenShift / Containers / Ansible Other Certifications: SAP Netweaver / ITIL / IBM Software Quality
  3. 3. Edson Yanaga Director of Developer Experience at Red Hat yanaga@redhat.com @yanaga Java Champion Microsoft MVP
  4. 4. developers.redhat.com http://developers.redhat.comhttp://developers.redhat.com
  5. 5. @rafabene / @yanaga Why do you want to run your application inside containers?
  6. 6. @rafabene / @yanaga ● Lightweight footprint and minimal overhead, ● Portability across machines, ● Simplify DevOps practices, ● Speeds up Continuous Integration, ● Empower Microservices Architectures. ● Isolation Container Advantages Container Engine
  7. 7. @rafabene / @yanaga A way to run a Linux container: $ docker run -d <image-name> A single and isolated Linux process running in a single machine
  8. 8. @rafabene / @yanaga DevOps challenges for multiple containers ● How to scale? ● How to avoid port conflicts? ● How to manage them in multiple hosts? ● What happens if a host has a trouble? ● How to keep them running? ● How to update them? ● Where are my containers? Node Node Logger Node Node Node Node
  9. 9. @rafabene / @yanaga Greek for “Helmsman”; also the root of the word “Governor” (from latin: gubernator) ● Container orchestrator ● Supports multiple cloud and bare-metal environments ● Inspired by Google’s experience with containers ● Open source, written in Go Manage applications, not machines Meet Kubernetes
  10. 10. @rafabene / @yanaga Version 1.3 Hosted on GitHub 800+ contributors 34,000+ commits 16,000+ GitHub stars Red Hat HP IBM Mesosphere Microsoft Project Partners CoreOS Pivotal SaltStack VMWare http://kubernetes.io/ https://github.com/kubernetes/kubernetes Open Source community
  11. 11. Master API Server Service Layer VirtualPhysical Private Public Persistent Storage Node Node Logger Node Node Node Node Dev Ops SCM (Git/Svn) CI/CD Automation Routing Layer Registry SDN Overlay Network Controllers - Scheduler - Replication - Services - Builds - Routes - Deployment Kubernetes OpenShift - Deployments - Builds - ImageStreams
  12. 12. @rafabene developers.redhat.com Kubernetes Concepts Pod Replication Controller Service Label One or More Containers Shared IP Shared Storage Volume Shared Resources Shared Lifecycle Ensures that a specified number of pod replicas are running at any one time Grouping of pods, act as one, has stable virtual IP and DNS name Key/Value pairs associated with Kubernetes objects (e.g. env=production)
  13. 13. @rafabene / @yanaga Concept: Pod ● Group of containers ● Live and die together ● Share: ○ IP ○ Secrets ○ Labels * ○ Volumes * * we will talk about these concepts later Labels Application Administrative console Log collector IP: 10.x.x.x Volume
  14. 14. @rafabene / @yanaga Concept: POD Defining a POD as YAML: apiVersion: v1 kind: Pod metadata: name: myPod labels: key: value spec: containers: - name: mysql image: username/image - name: phpMyAdmin image: username/image2 key: value myPOD mysql phpMy..
  15. 15. SCM (Git/Svn) Master API Server Service Layer VirtualPhysical Private Public Persistent Storage Node Node Logger Node Node Node Node Dev Ops CI/CD Automation Routing Layer Registry SDN Overlay Network Controllers - Scheduler - Replication - Services - Builds - Routes - Deployment Kubernetes OpenShift - Deployments - Builds - ImageStreams
  16. 16. SCM (Git/Svn) Master API Server Service Layer VirtualPhysical Private Public Persistent Storage Node Node Logger Node Node Node Node Dev Ops CI/CD Automation Routing Layer Registry SDN Overlay Network Controllers - Scheduler - Replication - Services - Builds - Routes - Deployment Kubernetes OpenShift - Deployments - Builds - ImageStreams
  17. 17. SCM (Git/Svn) Master API Server Service Layer VirtualPhysical Private Public Persistent Storage Node Node Logger Node Node Node Node Dev Ops CI/CD Automation Routing Layer Registry SDN Overlay Network Controllers - Scheduler - Replication - Services - Builds - Routes - Deployment Kubernetes OpenShift - Deployments - Builds - ImageStreams
  18. 18. @rafabene / @yanaga Concept: Replication Controllers Defining a Replication Controller as YAML: apiVersion: v1 kind: Pod metadata: name: myPod labels: key: value spec: containers: - name: myPod image: username/image ports: - name: http containerPort: 8080 apiVersion: v1 kind: ReplicationController metadata: name: myRC spec: replicas: 4 template: metadata: spec:
  19. 19. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 2.0 Everything in Kubernetes can have a label Node Logger Node NodeNode
  20. 20. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 2.0 Node Logger Node NodeNode
  21. 21. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 2.0 Node Logger Node NodeNode
  22. 22. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 2.0 Node Logger Node NodeNode
  23. 23. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 2.0 Node Logger Node NodeNode
  24. 24. @rafabene / @yanaga Concept: Labels App: Cool Env: Dev Version: 1.0 App: Cool Env: Dev Version: 2.0 App: Cool Env: Prod Version: 1.0 App: Cool Env: Prod Version: 2.0 Node Logger Node NodeNode
  25. 25. @rafabene / @yanaga Concept: Labels metadata: name: objectName labels: App: Cool Env: Dev Version: 1.0 Defining Labels as YAML: (can be placed in any object metadata) App: Cool Env: Dev Version: 1.0
  26. 26. @rafabene / @yanaga Node 2 POD App: Cool Env: Prod Version: 1.0 POD Service Labels selector: ● App=Cool ● Env=Prod IP: 172.x.x.x App: Nice Env: Prod Version: 1.0 Concept: Services Node 1 POD
  27. 27. @rafabene / @yanaga Concept: Services apiVersion: v1 kind: Service metadata: name: myService labels: ... spec: ports: - port: 80 targetPort: 80 selector: App: Cool Env: Prod Defining a Service as YAML: myService Labels selector: ● App=Cool ● Env=Prod IP: 172.x.x.x
  28. 28. @rafabene / @yanaga Using Environment variables: Using internal DNS: $ ping mysql Service discovery inside Kubernetes
  29. 29. @rafabene / @yanaga Other concepts Rolling updatesPersistent Volumes
  30. 30. @rafabene / @yanaga Admin Owned Users Owned Persistent Volume GCE PD AWS LB NFS GlusterFS Persistent Volume Claim POD Volume ● Admin provisions them, Users claim them ● High-level abstraction ● Pods can mount PVCs as Volumes Concept: Persistent Volumes
  31. 31. @rafabene / @yanaga Deployment Concept: Rolling Updates Pod Replication Controller Pod Pod Pod App: Cool Version: 1.0 Version: 1.0 Replicas: 4 Backend Replication Controller Version: 2.0 Replicas: 1 PodPod Pod Pod App: Cool Version: 2.0 Version: 1.0 Replicas: 3 Version: 2.0 Replicas: 2 Version: 1.0 Replicas: 2 Version: 2.0 Replicas: 3 Version: 1.0 Replicas: 1 Version: 2.0 Replicas: 4
  32. 32. @rafabene / @yanaga Kubernetes lab
  33. 33. @rafabene / @yanaga Application Overview
  34. 34. @rafabene / @yanaga
  35. 35. @rafabene / @yanaga Hello World Service - Greet Guestbook Service - Create Guestbook Service - Retrieve
  36. 36. @rafabene / @yanaga Lab infrastructure Hypervisor RHEL VM Image ● OpenShift ● Kubernetes ● Docker Container Development Kit http://developers.redhat.com/products/cdk/download/
  37. 37. @rafabene / @yanaga Kubernetes lab VERY IMPORTANT http://bit.ly/kubernetes-lab Follow me on the Setup environment section!
  38. 38. developers.redhat.com http://developers.redhat.comhttp://developers.redhat.com
  39. 39. @RAFABENE

×