Slide 1

Slide 1 text

Kubernetes and OpenShift For JavaScript Developers Jan Kleinert [email protected] March 8, 2019

Slide 2

Slide 2 text

@jankleinert 2 Jan Kleinert Developer Advocate, Red Hat twitter/github: @jankleinert Hello!

Slide 3

Slide 3 text

@jankleinert 3 What is Kubernetes and why do we need it? 4 basic resource types What is OpenShift? Build, automate, iterate, collaborate What we’ll cover

Slide 4

Slide 4 text

@jankleinert 4 What app are we deploying?

Slide 5

Slide 5 text

@jankleinert Why do we need Kubernetes? 5

Slide 6

Slide 6 text

@jankleinert 6 What is Kubernetes?

Slide 7

Slide 7 text

@jankleinert 7 Kubernetes is... An open source platform for running container-based workloads and managing them at scale

Slide 8

Slide 8 text

@jankleinert 8 Kubernetes provides... An API API object primitives include these attributes: kind apiVersion metadata spec status

Slide 9

Slide 9 text

@jankleinert 9 Basic K8s Terminology 1. node 2. pod 3. service 4. deployment

Slide 10

Slide 10 text

@jankleinert 10 Node ● Node: a host machine where containerized processes run ● Node activity is managed via one or more Master instances

Slide 11

Slide 11 text

@jankleinert 11 Pod ● A group of one or more co-located containers ● Minimum unit of scale kind: Pod apiVersion: v1 metadata: creationTimestamp: name: hello-k8s labels: run: hello-k8s spec: containers: - name: hello-k8s image: jkleinert/raleigh-dogparks:v1 ports: - containerPort: 8080 resources: {}

Slide 12

Slide 12 text

@jankleinert 12 https://youtu.be/E7KWcvuFVns

Slide 13

Slide 13 text

@jankleinert 13 Service ● Acts as a single endpoint for a collection of replicated pods ● Like a load balancer kind: Service apiVersion: v1 metadata: name: hello-k8s creationTimestamp: labels: run: hello-k8s spec: ports: - protocol: TCP port: 8080 targetPort: 8080 selector: run: hello-k8s type: LoadBalancer status: loadBalancer: {}

Slide 14

Slide 14 text

@jankleinert 14 https://youtu.be/mkLNa_5w_58

Slide 15

Slide 15 text

@jankleinert 15 Deployment ● Helps you specify container runtime requirements (in terms of pods) kind: Deployment
 apiVersion: apps/v1beta1
 metadata:
 name: hello-k8s
 creationTimestamp: 
 labels:
 run: hello-k8s
 spec:
 replicas: 1
 selector:
 matchLabels:
 run: hello-k8s
 template:
 metadata:
 creationTimestamp: 
 labels:
 run: hello-k8s
 spec:
 containers:
 - name: hello-k8s
 image: jkleinert/raleigh-dogparks:v1
 resources: {}
 strategy: {}
 status: {}

Slide 16

Slide 16 text

@jankleinert 16 https://youtu.be/1gjTeR4tsj0

Slide 17

Slide 17 text

@jankleinert 17 https://youtu.be/V8BOQhmC30w

Slide 18

Slide 18 text

@jankleinert 18 https://youtu.be/C8xAqfFaSLI

Slide 19

Slide 19 text

@jankleinert 19 https://youtu.be/YEkIAWFc9WE

Slide 20

Slide 20 text

@jankleinert 20 What is OpenShift?

Slide 21

Slide 21 text

@jankleinert 21 Build Build and deploy container images

Slide 22

Slide 22 text

@jankleinert 22 Source to Image Combines source repos and operationally- maintained builder images to produce application images

Slide 23

Slide 23 text

@jankleinert 23 Source to Image Available as a standalone project, for use with Jenkins or other external builder processes: github.com/openshift/source-to-image

Slide 24

Slide 24 text

@jankleinert 24 Automate git push to deploy

Slide 25

Slide 25 text

@jankleinert 25 Iterate

Slide 26

Slide 26 text

@jankleinert 26 oc rsync Useful for testing changes prior to a commit Copies files to a container; use the --watch flag to continuously sync oc rsync --exclude='node_modules*' . YOUR_PODNAME:


Slide 27

Slide 27 text

@jankleinert 27 odo (OpenShift Do) A developer-focused command line tool for fast, iterative development on OpenShift https://github.com/redhat-developer/odo https://learn.openshift.com/introduction/developing-with-odo/

Slide 28

Slide 28 text

@jankleinert 28 Collaborate Share and replicate your success

Slide 29

Slide 29 text

@jankleinert 29 Service Catalog & Brokers

Slide 30

Slide 30 text

@jankleinert 30 Templates as Installers Install a template into the current project, making it easier to reuse: oc create -f template.json


Slide 31

Slide 31 text

@jankleinert 31 Templates as Installers Create an application from an installed template, from a file, or from a URL: oc new-app -f template.json


Slide 32

Slide 32 text

@jankleinert 32 Multi-service App Example Node.js and MongoDB multi-service app oc create -f https://raw.githubusercontent.com/ openshift-roadshow/nationalparks-js/master/ nationalparks-js.json

Slide 33

Slide 33 text

@jankleinert 33 Kubernetes By Example: http://kubernetesbyexample.com Interactive Learning Portal: https://learn.openshift.com Backend repo: https://github.com/jankleinert/k8s-visualizer-backend Frontend repo: https://github.com/jankleinert/k8s-visualizer-frontend Raleigh dog parks repo: https://github.com/jankleinert/raleigh-dogparks Resources

Slide 34

Slide 34 text

THANK YOU plus.google.com/+RedHat linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat