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

Automating Stateful Applications Using Kubernetes Operators

Jan Kleinert
February 06, 2019

Automating Stateful Applications Using Kubernetes Operators

Kubernetes scales and manages stateless applications quite easily. Stateful applications can require more work. They can be harder to dynamically manage with data intact and sometimes come with their own notion of clustering. Operators are Kubernetes agents that know how to deploy, scale, manage, back up, and even upgrade complex stateful applications. The Operator pattern was introduced by CoreOS. It has been adopted by many community projects, including Rook and Prometheus, and is supported by this spring’s release of the Operator Framework by Red Hat.

First, we offer an overview of Operators and lead a demonstration on installing and using an Operator on a OpenShift Kubernetes cluster. With an understanding of Operators in place, we then detail the Operator Framework and its main components, the Operator SDK and the lifecycle management backplane.

Jan Kleinert

February 06, 2019
Tweet

More Decks by Jan Kleinert

Other Decks in Technology

Transcript

  1. Automating Stateful Applications
    with Kubernetes Operators
    Jan Kleinert
    [email protected]
    February 6, 2019

    View full-size slide

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

    View full-size slide

  3. @jankleinert
    3
    What is Kubernetes?

    View full-size slide

  4. @jankleinert
    4
    Why should you care about operators?

    View full-size slide

  5. @jankleinert
    5
    Scaling stateless apps: easy

    View full-size slide

  6. @jankleinert
    6
    $ kubectl scale deploy/staticweb --replicas=3

    View full-size slide

  7. @jankleinert
    7
    scale up
    count=1
    desired=3
    ReplicaSet

    View full-size slide

  8. @jankleinert
    8
    start
    count=3
    desired=3
    ReplicaSet

    View full-size slide

  9. @jankleinert
    9
    What about apps that store data?

    View full-size slide

  10. @jankleinert
    10
    Creating a database is easy

    View full-size slide

  11. @jankleinert
    11
    $ kubectl run db --image=quay.io/my/db

    View full-size slide

  12. @jankleinert
    12
    Running a database over time is harder

    View full-size slide

  13. @jankleinert
    13
    ⏣ Resize/Upgrade
    ⏣ Reconfigure
    ⏣ Backup
    ⏣ Healing

    View full-size slide

  14. @jankleinert
    14
    Every application on any platform must
    be installed, configured, managed, and
    upgraded over time
    Patching is critical to security

    View full-size slide

  15. @jankleinert
    15
    Anything not automated is slowing you down

    View full-size slide

  16. @jankleinert
    16
    If only Kubernetes knew...

    View full-size slide

  17. @jankleinert
    17

    View full-size slide

  18. @jankleinert
    18

    View full-size slide

  19. @jankleinert
    19
    Operators are automated software
    managers that deal with installation and
    lifecycle of Kubernetes applications

    View full-size slide

  20. @jankleinert
    20
    1. Application-specific custom controllers
    2. Custom resource definitions (CRD)
    Extending the Kubernetes API

    View full-size slide

  21. @jankleinert
    21
    Application-Specific Controllers

    View full-size slide

  22. @jankleinert
    22
    Custom Resource Definition (CRD)
    kind: ProductionReadyDatabase
    apiVersion: database.example.com/v1alpha1
    metadata:
    name: my-production-ready-database
    spec:
    clusterSize: 3
    readReplicas: 2
    version: v4.0.1
    [...]

    View full-size slide

  23. @jankleinert
    23
    {
    }

    View full-size slide

  24. @jankleinert
    24
    What is etcd?
    Example: etcd Operator
    ● distributed key-value store
    ● primary datastore of
    Kubernetes
    ● stores and replicates all
    Kubernetes cluster state

    View full-size slide

  25. @jankleinert
    25
    Example: etcd Operator
    kind: EtcdCluster
    apiVersion: etcd.database.coreos.com/v1beta2
    metadata:
    name: example-etcd-cluster
    spec:
    size: 3
    version: "3.1.0"

    View full-size slide

  26. @jankleinert
    26
    Example: etcd Operator

    View full-size slide

  27. @jankleinert
    27

    View full-size slide

  28. @jankleinert
    28
    https://learn.openshift.com/operatorframework/
    (or come by the OpenShift booth #601)
    Try It! Hands-On Operator Tutorials

    View full-size slide

  29. @jankleinert
    29
    https://github.com/operator-framework/awesome-operators
    ● etcd
    ● Prometheus
    ● Elasticsearch
    ● MySQL
    ● “and many more!”
    Use Operators Today

    View full-size slide

  30. @jankleinert
    30
    https://github.com/operator-framework

    View full-size slide

  31. @jankleinert
    31

    View full-size slide

  32. @jankleinert
    32

    View full-size slide

  33. @jankleinert
    33

    View full-size slide

  34. @jankleinert
    34
    Operator SDK

    View full-size slide

  35. @jankleinert
    35
    https://github.com/operator-framework
    https://coreos.com/operators/
    https://github.com/operator-framework/awesome-operators
    https://coreos.com/blog/introducing-operator-framework
    https://learn.openshift.com/operatorframework/
    Resources

    View full-size slide

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

    View full-size slide

  37. Rate today ’s session
    Session page on oreillysacon.com/ny O’Reilly Events App

    View full-size slide