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

Automating Stateful Applications with Kubernetes Operators

49f894a7f36362469c7b69a993dc6453?s=47 Jan Kleinert
September 23, 2019

Automating Stateful Applications with Kubernetes Operators


Jan Kleinert

September 23, 2019

More Decks by Jan Kleinert

Other Decks in Technology


  1. Automating Stateful Applications with Kubernetes Operators Jan Kleinert jan.kleinert@redhat.com September

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

  3. @jankleinert 3 What is Kubernetes? An open source orchestration system

    for managing containerized workloads across a cluster of nodes.
  4. @jankleinert 4 Pod Deployment DaemonSet ReplicaSet StatefulSet Job Kubernetes objects

    are persistent entities that represent the state of your cluster that you can manage with the K8s API EndPoints Ingress Service ConfigMap Secret StorageClass Namespace NetworkPolicy PersistentVolume Role RoleBinding ServiceAccount Understanding Kubernetes objects
  5. @jankleinert 5 Kubernetes Object Definitions kind: Pod apiVersion: v1 metadata:

    name: example-app spec: containers: - name: example image: quay.io/my/app:v1.2.0 [...]
  6. @jankleinert 6 Why should you care about operators?

  7. @jankleinert 7 Scaling stateless apps: easy

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

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

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

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

  12. @jankleinert 12 Creating a database is easy

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

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

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

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

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

  18. @jankleinert 18 If only Kubernetes knew...

  19. @jankleinert 19

  20. @jankleinert 20

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

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

    (CRD) Extending the Kubernetes API
  23. @jankleinert 23 The Operator Pattern K8S API CUSTOM RESOURCE &

  24. @jankleinert 24 Application-Specific Controllers

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

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

    key-value store • primary datastore of Kubernetes • stores and replicates all Kubernetes cluster state
  28. @jankleinert 28 Example: etcd Operator kind: EtcdCluster apiVersion: etcd.database.coreos.com/v1beta2 metadata:

    name: example-etcd-cluster spec: size: 3 version: "3.1.0"
  29. @jankleinert 29 Example: etcd Operator

  30. @jankleinert 30

  31. @jankleinert 31 https://learn.openshift.com/operatorframework/ Try It! Hands-On Operator Tutorials

  32. @jankleinert 32 Use Operators Today OperatorHub.io is a home for

    the Kubernetes community to share Operators. Find an existing Operator or list your own today.
  33. @jankleinert 33 https://github.com/operator-framework

  34. @jankleinert 34

  35. @jankleinert 35

  36. @jankleinert 36

  37. @jankleinert 37 Operator Maturity Model Phase I Phase II Phase

    III Phase IV Phase V Basic Install Automated application provisioning and configuration management Seamless Upgrades Patch and minor version upgrades supported Full Lifecycle App lifecycle, storage lifecycle (backup, failure recovery) Deep Insights Metrics, alerts, log processing and workload analysis Auto Pilot Horizontal/vertical scaling, auto config tuning, abnormal detection, scheduling tuning
  38. @jankleinert 38 https://github.com/operator-framework https://coreos.com/operators/ https://operatorhub.io https://coreos.com/blog/introducing-operator-framework https://learn.openshift.com/operatorframework/ Resources

  39. linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat Red Hat is the world’s leading

    provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you 39