Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Jan Kleinert

March 08, 2019
Tweet

More Decks by Jan Kleinert

Other Decks in Technology

Transcript

  1. @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
  2. @jankleinert 7 Kubernetes is... An open source platform for running

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

    these attributes: kind apiVersion metadata spec status
  4. @jankleinert 10 Node • Node: a host machine where containerized

    processes run • Node activity is managed via one or more Master instances
  5. @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: {}
  6. @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: {}
  7. @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: {}
  8. @jankleinert 22 Source to Image Combines source repos and operationally-

    maintained builder images to produce application images
  9. @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
  10. @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:

  11. @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/
  12. @jankleinert 30 Templates as Installers Install a template into the

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

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

  14. @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
  15. @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