$30 off During Our Annual Pro Sale. View Details »

Container Orchestration - Kubernetes and OpenShift

Container Orchestration - Kubernetes and OpenShift

Running Docker Containers in production brings several challenges. Container orchestration tools and platforms provide solutions for them. We will look at Kubernetes - the leader in container orchestration - to understand the concepts and how to deploy applications. OpenShift adds additional features to Kubernetes, which makes it a full PaaS solution for the enterprise.

Christian Köberl

September 26, 2017
Tweet

More Decks by Christian Köberl

Other Decks in Technology

Transcript

  1. Christian Köberl
    Container Orchestration

    View Slide

  2. Christian Köberl
    Software Architect / Developer
    Develops web apps since 1999

    View Slide

  3. Linux Containers
    Source: https://www.redhat.com/de/containers/whats-a-linux-container

    View Slide

  4. Docker
    Source: https://docs.docker.com/opensource/ways/meetups/

    View Slide

  5. Simple Deployment
    SSH into machine – docker run myapp
    • Very simple
    • BUT what about
    • Failure – who/what restarts the container?
    • Load Balancing
    • Scaling
    • Updates
    • …

    View Slide

  6. View Slide

  7. Source: http://www.cargolaw.com/2011nightmare_mv_rena.html

    View Slide

  8. Why Container Orchestration?
    • High Availability
    • Running on multiple hosts
    • (Auto-)Scaling
    • Load Balancing
    • Rolling Upgrades
    • Storage management
    • Monitoring
    • Authentication & Authorization

    View Slide

  9. Scheduler
    Container Orchestration
    Scheduler
    Node 1 Node 2 Node 3
    Run 3 instances of
    MyApp
    Distributed Database
    Container Engine Container Engine Container Engine
    Run Postgres where
    backup=yes
    backup=yes
    Postgres
    MyApp
    MyApp MyApp

    View Slide

  10. Network
    Container Orchestration
    Node 1 Node 2 Node 3
    Container Engine Container Engine Container Engine
    Postgres
    MyApp
    MyApp
    MyApp
    172.16.0.2 172.16.0.3
    192.168.0.12
    10.40.1.12
    10.40.1.13 10.40.1.14

    View Slide

  11. Service Discovery / Load Balancing
    Container Orchestration
    Node 1 Node 2 Node 3
    Container Engine Container Engine Container Engine
    Postgres
    MyApp
    MyApp
    MyApp
    myapp:80
    myapp:80 myapp:80
    (External)
    Load Balancer
    myapp.domain.com

    View Slide

  12. Container Orchestration - Additional Features
    • Resource Management
    • CPU (GPU) / Memory
    • (Persistent) Volumes
    • Configuration / Secret Management
    • Distributed Job Scheduling (CRON)
    • Container Registry
    • …

    View Slide

  13. With good Container Orchestration
    your whole data center will look like a
    single server with endless resources.
    > Data center operating system
    https://www.oreilly.com/ideas/why-the-data-center-needs-an-operating-system

    View Slide

  14. Competing Systems
    Kubernetes Mesos Docker Datacenter

    View Slide

  15. Production-Grade Container Orchestration

    View Slide

  16. View Slide

  17. Abhishek Verma, Luis Pedrosa, Madhukar R. Korupolu, David Oppenheimer, Eric Tune, John Wilkes:
    Large-scale cluster management at Google with Borg, https://research.google.com/pubs/pub43438.html
    Google's
    BORG
    Kuberntes Master
    Kubelet
    Kubelet
    Kubelet
    Kubelet
    etcd
    Kubernetes
    YAML/JSON

    View Slide

  18. Demo 1 - Wekan
    • Deploying Wekan
    1. Deploy MongoDB with Volume
    2. Deploy Wekan application

    View Slide

  19. K8s – Logical View
    Namespace
    Service
    Pod
    Container
    Container
    Pod
    Container
    Container
    ReplicaSet
    Deployment
    Pod
    Container
    Volume
    ReplicaSet
    Deployment
    Service
    Secret
    ConfigMap

    View Slide

  20. Kubernetes - Concepts
    • Workloads
    • Pod
    • Deployment
    • ReplicaSet (former Replication Controller)
    • StatefulSet – for legacy apps
    • Job / CronJob
    • Service
    • Volume
    • Configuration
    • ConfigMap
    • Secret

    View Slide

  21. Kubernetes - Objects + REST API
    • All objects represented in YAML or JSON
    • REST API for all objects
    • Command Line and UI talk to REST API

    View Slide

  22. Service apiVersion: v1
    kind: Service
    metadata:
    labels:
    app: wekandb
    version: "3.4"
    name: wekandb
    namespace: wekan
    spec:
    ports:
    - name: tcp-27017
    port: 27017
    protocol: TCP
    targetPort: 27017
    selector:
    app: wekandb
    version: "3.4"
    sessionAffinity: None
    type: ClusterIP

    View Slide

  23. Red Hat® OpenShift is a container application platform
    that brings Docker and Kubernetes to the enterprise.

    View Slide

  24. Demo 2 - Angular Heroes
    • Deploy Angular Spring Heroes
    • Angular Heroes Tutorial App
    • Spring Boot Backend
    • https://github.com/porscheinformatik/angular-spring-heroes
    • Update Code
    • GitHub Webhook triggers build

    View Slide

  25. OpenShift – Kubernetes PaaS
    • ImageStreams
    • Automatically Update Images / Deployments
    • Builds / Pipelines
    • Build from Source/Binary
    • Build via S2I or Docker (or custom)
    • Jenkins Pipeline Integration
    • Routes – integrated LB (HAProxy)
    • Templates
    • Blueprint for whole application

    View Slide

  26. OpenShift – Enterprise Kubernetes
    • SELinux with RHEL, CentOS or Atomic
    • Container running as non-root
    • Network Isolation between Namespaces
    • Automatic Security Updates via ImageStream/Builds

    View Slide

  27. https://learn.openshift.com

    View Slide

  28. Local Environment
    • Kubernetes - minikube
    • minikube start
    • Starts k8s cluster in VM
    • OpenShift
    • minishift
    same as minikube
    • oc cluster up
    Runs cluster in Docker containers

    View Slide

  29. Kubernetes Ecosystem
    • Lot's of cloud providers, biggest include Google, IBM, Microsoft
    • Different PaaS solutions: Deis, OpenShift, Kel, …
    • Helm
    • Kubernetes package manager
    • Installs whole application + dependencies

    View Slide

  30. Thanks! Questions?
    github.com/derkoe / @derkoe
    Source: https://www.docker.com/community-edition

    View Slide