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

More Decks by Jan Kleinert

Other Decks in Technology


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

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

  3. @jankleinert 3 What is Kubernetes?

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

  5. @jankleinert 5 Scaling stateless apps: easy

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

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

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

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

  10. @jankleinert 10 Creating a database is easy

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

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

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

  14. @jankleinert 14 Every application on any platform must be installed,

    configured, managed, and upgraded over time Patching is critical to security
  15. @jankleinert 15 Anything not automated is slowing you down

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

  17. @jankleinert 17

  18. @jankleinert 18

  19. @jankleinert 19 Operators are automated software managers that deal with

    installation and lifecycle of Kubernetes applications
  20. @jankleinert 20 1. Application-specific custom controllers 2. Custom resource definitions

    (CRD) Extending the Kubernetes API
  21. @jankleinert 21 Application-Specific Controllers

  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 [...]
  23. @jankleinert 23 { }

  24. @jankleinert 24 What is etcd? Example: etcd Operator • distributed

    key-value store • primary datastore of Kubernetes • stores and replicates all Kubernetes cluster state
  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"
  26. @jankleinert 26 Example: etcd Operator

  27. @jankleinert 27

  28. @jankleinert 28 https://learn.openshift.com/operatorframework/ (or come by the OpenShift booth #601)

    Try It! Hands-On Operator Tutorials
  29. @jankleinert 29 https://github.com/operator-framework/awesome-operators • etcd • Prometheus • Elasticsearch •

    MySQL • “and many more!” Use Operators Today
  30. @jankleinert 30 https://github.com/operator-framework

  31. @jankleinert 31

  32. @jankleinert 32

  33. @jankleinert 33

  34. @jankleinert 34 Operator SDK

  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

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

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