Kubernetes and OpenShift for JavaScript Developers

Kubernetes and OpenShift for JavaScript Developers

You’ve probably heard of Kubernetes and OpenShift already. But do you know the reasons why you might use them and more importantly, as a developer, how to get started? I’ll cover the basics of Kubernetes and OpenShift and how they relate to each other, and then we’ll walk through the process of building and deploying an app that uses Node.js and React to OpenShift.

49f894a7f36362469c7b69a993dc6453?s=128

Jan Kleinert

March 08, 2019
Tweet

Transcript

  1. Kubernetes and OpenShift For JavaScript Developers Jan Kleinert jan.kleinert@redhat.com March

    8, 2019
  2. @jankleinert 2 Jan Kleinert Developer Advocate, Red Hat twitter/github: @jankleinert

    Hello!
  3. @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
  4. @jankleinert 4 What app are we deploying?

  5. @jankleinert Why do we need Kubernetes? 5

  6. @jankleinert 6 What is Kubernetes?

  7. @jankleinert 7 Kubernetes is... An open source platform for running

    container-based workloads and managing them at scale
  8. @jankleinert 8 Kubernetes provides... An API API object primitives include

    these attributes: kind apiVersion metadata spec status
  9. @jankleinert 9 Basic K8s Terminology 1. node 2. pod 3.

    service 4. deployment
  10. @jankleinert 10 Node • Node: a host machine where containerized

    processes run • Node activity is managed via one or more Master instances
  11. @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: {}
  12. @jankleinert 12 https://youtu.be/E7KWcvuFVns

  13. @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: {}
  14. @jankleinert 14 https://youtu.be/mkLNa_5w_58

  15. @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: {}
  16. @jankleinert 16 https://youtu.be/1gjTeR4tsj0

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

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

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

  20. @jankleinert 20 What is OpenShift?

  21. @jankleinert 21 Build Build and deploy container images

  22. @jankleinert 22 Source to Image Combines source repos and operationally-

    maintained builder images to produce application images
  23. @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
  24. @jankleinert 24 Automate git push to deploy

  25. @jankleinert 25 Iterate

  26. @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:

  27. @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/
  28. @jankleinert 28 Collaborate Share and replicate your success

  29. @jankleinert 29 Service Catalog & Brokers

  30. @jankleinert 30 Templates as Installers Install a template into the

    current project, making it easier to reuse: oc create -f template.json

  31. @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

  32. @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
  33. @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
  34. THANK YOU plus.google.com/+RedHat linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat