Reaves.dev

v0.1.0

built using

Phoenix v1.7.17

Kubernetes

Overview

  • Containers vs VMs
  • Docker
  • What is Kubernetes
  • Use Cases

About Me

  • Stephen M. Reaves
  • BSCS from the real USC in 2018
  • Last year of OMSCS from GT
    • Distributed Computing
    • HPC
  • 6+ years as a software developer
  • 3 years spent at Red Hat working
    • OpenShift/Kubernetes and container tooling

Overview

  • Containers vs VMs
  • Docker
  • What is Kubernetes
  • Use Cases

Overview

  • Containers vs VMs
  • Docker Podman
  • What is Kubernetes
  • Use Cases

How do we ship software?

How do we ship software?

  • Install directly on hardware

How do we ship software?

  • Install directly on hardware
    • Pros
      • Simple

How do we ship software?

  • Install directly on hardware
    • Pros
      • Simple
    • Cons
      • Collisions

How do we ship software?

  • Install directly on hardware
  • Virtual Machines

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
"an efficient, isolated duplicate of a real computer machine."
Popek and Goldberg, 1974, "Formal Requirements for Virtualizable Third Generation Architectures"

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation
    • Cons
      • Overhead

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation
    • Cons
      • Overhead
        • Redudancy

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation
    • Cons
      • Overhead
      • Complex

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation
    • Cons
      • Overhead
      • Complex
        • paravirtualization vs full virtualization
        • KVM vs Xen vs Hyper-V vs VMWare

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
    • Pros
      • Isolation
    • Cons
      • Overhead
      • Complex
      • Still bound by hardware

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Containers

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Containers
    • LXC/LXD
    • Chroot
    • SystemD-nspawn
    • Jails
    • Docker

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Containers
    • LXC/LXD
    • Chroot
    • SystemD-nspawn
    • Jails
    • Docker

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Containers
    • OCI
      • Docker
      • Podman
      • Kubernetes

OCI

The Open Container Initiative (OCI) is a Linux Foundation project, started in June 2015 by Docker, CoreOS, and the maintainers of appc (short for "App Container") to design open standards for operating system-level virtualization (containers)
Wikipedia

What is a Container?

What is a Container?

docker container

What is a Container?

  • Dockerfile
  • Docker image
  • Docker container
FROM alpine:latest
RUN apk add --no-cache python2
CMD ["python2"]

What is a Container?

GdockerfileDockerfiledocker_imageDocker Imagedockerfile->docker_image  docker builddocker_containerDocker Containerdocker_image->docker_container  docker run

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker
    • Pros
      • Simple
      • Interchangeable
      • Isolation
      • Fast
      • Declarative building

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker
    • Pros
      • Simple
      • Interchangeable
      • Isolation
      • Fast
      • Declarative building
    • Cons
      • Single host
      • Manual scaling/orchestration
      • Root daemon
      • Combination of containers still requires extra tools (docker-compose)

What is Podman?

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images.
Podman

What is Podman?

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images.
Podman

Drop in replacement for Docker

What is Podman?

Podman is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images.
Podman

Drop in replacement for Docker

Superset of Docker that includes pods

What is a Pod?

Pods are groups of containers that run together and share the same resources, similar to Kubernetes pods.
Red Hat

What is a Pod?

Gcluster_hostHostcluster_pod1Podcluster_pod2Podcontainer1Containercontainer2Containercontainer1->container2container3Containercontainer2->container3container4Containercontainer5Containercontainer4->container5

What is a Pod?

Gcluster_hostHostcluster_pod1App 1cluster_pod2App 2nginxnginxappappnginx->apppostgrespostgresapp->postgresapiapimysqlmysqlapi->mysql

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker Podman

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker Podman
    • Pros
      • Simple
      • Interchangeable
      • Isolation
      • Fast
      • Declarative building
      • No Root daemon
      • Combination of containers out of the box

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker Podman
    • Pros
      • Simple
      • Interchangeable
      • Isolation
      • Fast
      • Declarative building
      • No Root daemon
      • Combination of containers out of the box
    • Cons
      • Single host
      • Manual scaling/orchestration

How do we ship software?

  • Install directly on hardware
  • Virtual Machines
  • Docker Podman
  • Kubernetes

What is Kubernetes?

Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both `declarative configuration` and `automation`.
Kubernetes

Before

Gcluster_hostHostcluster_pod1App 1cluster_pod2App 2nginxnginxappappnginx->apppostgrespostgresapp->postgresapiapimysqlmysqlapi->mysql

After

Gcluster_host2Host 2cluster_pod2App 2cluster_hostHost 1cluster_pod1App 1apiapimysqlmysqlapi->mysqlnginxnginxappappnginx->apppostgrespostgresapp->postgres

Kubernetes Features

  • Declarative configuration

Kubernetes Features

  • Declarative configuration
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx:1.14.2
    ports:
    - containerPort: 80

Kubernetes Features

  • Declarative configuration
    • GitOps

Kubernetes Features

  • Declarative configuration
    • GitOps
    • podman kube play -f nginx.yaml
    • podman kube gen -f nginx.yaml
      • Can also be started via systemd

Kubernetes Features

  • Declarative configuration
  • Automatic scaling

Kubernetes Features

  • Declarative configuration
  • Automatic scaling
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3 # <----------------- How many pods?
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec: # <--------------------- Pod spec
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Kubernetes Features

  • Declarative configuration
  • Automatic scaling
Gcluster_hostHostcluster_deploymentDeploymentcluster_pod1pod 1cluster_pod2pod 2cluster_pod3pod 3nginx1nginxnginx2nginxnginx3nginx

Kubernetes Features

  • Declarative configuration
  • Automatic scaling
  • Self-healing

Kubernetes Features

  • Declarative configuration
  • Automatic scaling
  • Self-healing
  • Service discovery

Kubernetes Features

Gcluster_hostcluster_deploymentDeploymentcluster_pod1pod 1cluster_pod2pod 2cluster_pod3pod 3nginx1appnginx2appnginx3appapp2app2serviceserviceapp2->serviceservice->nginx1service->nginx2service->nginx3

Kubernetes Features

Gcluster_hostcluster_deploymentDeploymentcluster_pod1pod 1cluster_pod2pod 2cluster_pod3pod 3cluster_pod4pod 4nginx1appnginx2appnginx3appnginx4appapp2app2serviceserviceapp2->serviceservice->nginx1service->nginx2service->nginx3service->nginx4

Kubernetes Pieces

  • App
    • Deployment
    • StatefulSet
    • DaemonSet
  • Networking
    • Service
    • Ingress/Gateway
  • Storage
    • Persistent Volume
    • Persistent Volume Claim
  • Environment
    • ConfigMap
    • Secret

How does it work?

  • ResourceDefintion
  • Resource
  • Controller
    • Reconcile loop

How does it work?

NodeControlPlaneContainerRuntimeKubletAPI-ServerDeploymentControllerReplicaSetControllerPodControllerKube-SchedulerContainerRuntimeKubletAPI-ServerDeploymentControllerReplicaSetControllerPodControllerKube-SchedulerQuery deploymentsReturn deploymentsPost ReplicaSetQuery ReplicaSetsReturn ReplicaSetsPost PodsQuery PodsReturn PodsPost Pod statusQuery unscheduled PodsReturn unscheduled PodsUpdate Pod with Node bindingQuery Pods for nodeReturn Pods for nodeRun Pod

Extending with Operators

  • ResourceDefintion -> CustomResourceDefinition
  • Resource -> CustomResource
  • Controller -> CustomController

How does it work?

NodeControlPlaneContainerRuntimeKubletAPI-ServerCustomControllerDeploymentControllerReplicaSetControllerPodControllerKube-SchedulerContainerRuntimeKubletAPI-ServerCustomControllerDeploymentControllerReplicaSetControllerPodControllerKube-SchedulerCustom logicQuery CustomResourcesReturn CustomResourcesPost DeploymentQuery deploymentsReturn deploymentsPost ReplicaSetQuery ReplicaSetsReturn ReplicaSetsPost PodsQuery PodsReturn PodsPost Pod statusQuery unscheduled PodsReturn unscheduled PodsUpdate Pod with Node bindingQuery Pods for nodeReturn Pods for nodeRun Pod

Example: Ceph Operator

Ceph Operator Diagram

Openshift Data Foundation

ODF

Source: docs.redhat.com

Openshift Data Foundation

OCS

Source: docs.redhat.com

Openshift Data Foundation

ROOK

Source: docs.redhat.com

Opportunities

DDN CSI

Use Cases

  • Microservices
  • High-Availability workloads
  • CI/CD pipelines
  • Big Data/Machine Learning
  • Batch Processing
  • Dev/Test/Prod Environments
  • Edge Computing

Thank you