Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Automating with operators - FossAsia Summit 2019

401 vues

Publié le

Kubernetes scales and manages stateless applications quite easily. Stateful applications can require more work. Databases, caching systems, and file stores are 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, backup, and even upgrade complex, stateful applications.

This talk will provide an update on the Operator pattern introduced by CoreOS, adopted by many community projects like Rook, Prometheus, and others, and supported by this spring’s release of the Operator Framework by Red Hat. With an understanding of Operators in place, the session will go on to detail the Operator Framework and its main components, the Operator SDK and the Lifecycle management backplane.

Publié dans : Technologie
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Automating with operators - FossAsia Summit 2019

  1. 1. Automating with Operators
  2. 2. @jorgemoralespou / @grahamdumpleton
  3. 3. @jorgemoralespou / @grahamdumpleton ● OpenShift Developer Advocate @ Red Hat ● Python guru ● Sydney, Australia ● Codename: Grumpy old man ● OpenShift Developer Advocate @ Red Hat ● Java, DevExp and DevOps fanboy ● Madrid, Spain ● Codename: The mexican Graham DumpletonJorge Morales
  4. 4. @jorgemoralespou / @grahamdumpleton ● Why you should care about Operators ● What are Operators? ● How Operators work ● Building Operators ● Managing Operators ● Operator framework ● Examples What we’ll cover
  5. 5. @jorgemoralespou / @grahamdumpleton Scaling stateless apps: Easy
  6. 6. @jorgemoralespou / @grahamdumpleton $ kubectl scale deploy/web --replicas=3
  7. 7. @jorgemoralespou / @grahamdumpleton
  8. 8. @jorgemoralespou / @grahamdumpleton
  9. 9. @jorgemoralespou / @grahamdumpleton What about apps that… store data? Or have their own notion of a “cluster”? Databases?
  10. 10. @jorgemoralespou / @grahamdumpleton Running a database is easy
  11. 11. @jorgemoralespou / @grahamdumpleton $ kubectl run db --image=quay.io/my/db
  12. 12. @jorgemoralespou / @grahamdumpleton Running it over time is harder
  13. 13. @jorgemoralespou / @grahamdumpleton ⏣ Resize/Upgrade ⏣ Reconfigure ⏣ Backup ⏣ Healing
  14. 14. @jorgemoralespou / @grahamdumpleton Every application on any platform must be installed, configured, managed, and upgraded over time Patching is critical to security
  15. 15. @jorgemoralespou / @grahamdumpleton “Anything not automated is slowing you down.”
  16. 16. @jorgemoralespou / @grahamdumpleton If only k8s knew…
  17. 17. @jorgemoralespou / @grahamdumpleton Grant Doe MEET THIS GUY
  18. 18. @jorgemoralespou / @grahamdumpleton KNOWLEDGE IN A BOX
  19. 19. @jorgemoralespou / @grahamdumpleton PRODUCTION READY DBs
  20. 20. @jorgemoralespou / @grahamdumpleton Operators are automated software managers for Kubernetes applications: Install and Lifecycle
  21. 21. @jorgemoralespou / @grahamdumpleton The recipe
  22. 22. @jorgemoralespou / @grahamdumpleton Extend Kubernetes
  23. 23. @jorgemoralespou / @grahamdumpleton Application-specific controllers that extend the Kubernetes API to create, configure, and manage instances of complex stateful applications on behalf of a Kubernetes user
  24. 24. @jorgemoralespou / @grahamdumpleton kind: ProductionReadyDatabase apiVersion: database.example.com/v1alpha1 metadata: name: my-production-ready-database spec: clusterSize: 3 readReplicas: 2 version: v4.0.1 [...] Extend the Kubernetes API through the Custom Resource Definition (CRD) mechanism
  25. 25. @jorgemoralespou / @grahamdumpleton Extend the Kubernetes API through the Custom Resource Definition (CRD) mechanism { }
  26. 26. @jorgemoralespou / @grahamdumpleton Reconciling desired state for your application { }
  27. 27. @jorgemoralespou / @grahamdumpleton https://github.com/operator-framework
  28. 28. Keep Operators up to date
  29. 29. @jorgemoralespou / @grahamdumpleton An Operator for Operators OPERATOR LIFECYCLE MANAGER
  30. 30. @jorgemoralespou / @grahamdumpleton Over-the-air updates
  31. 31. @jorgemoralespou / @grahamdumpleton OPERATOR MARKETPLACE
  32. 32. @jorgemoralespou / @grahamdumpleton
  33. 33. @jorgemoralespou / @grahamdumpleton operatorhub.io
  34. 34. @jorgemoralespou / @grahamdumpleton OPERATOR METERING
  35. 35. @jorgemoralespou / @grahamdumpleton Build your own operator
  36. 36. @jorgemoralespou / @grahamdumpleton Makes it easier to build Operators OPERATOR SDK
  37. 37. @jorgemoralespou / @grahamdumpleton 1. Scaffolding and code generation to bootstrap new projects
  38. 38. @jorgemoralespou / @grahamdumpleton 2. Extension points that cover common Operator use cases
  39. 39. @jorgemoralespou / @grahamdumpleton 3. High level APIs and abstractions to write operational logic
  40. 40. @jorgemoralespou / @grahamdumpleton Step by step (version 0.5.0)
  41. 41. @jorgemoralespou / @grahamdumpleton 1. Create a new operator project using the SDK Command Line Interface(CLI) $ operator-sdk new prodready-db-operator [--cluster-scoped]
  42. 42. @jorgemoralespou / @grahamdumpleton 2. Define new Custom Resource Definitions(CRD) APIs $ operator-sdk add api --api-version=database.example.com/v1alpha1 --kind=ProductionReadyDatabase
  43. 43. @jorgemoralespou / @grahamdumpleton spec: clusterSize: 3 version: v4.0.1 status: state: Running 3. Define the spec and status of the new Custom Resource Definition (CRD)
  44. 44. @jorgemoralespou / @grahamdumpleton 4. Use the SDK CLI to build and generate the operator and deployment manifests $ operator-sdk generate k8s
  45. 45. @jorgemoralespou / @grahamdumpleton 5. Add a new controller that will watch and reconcile the CR $ operator-sdk add controller --api-version=database.example.com/v1alpha1 --kind=ProductionReadyDatabase
  46. 46. @jorgemoralespou / @grahamdumpleton 6. Deploy and run the operator in the cluster $ k apply -f deploy/crd.yaml $ operator-sdk build quay.io/example/prodreadydb:v0.0.1 $ docker push quay.io/example/prodreadydb:v0.0.1 $ k apply -f deploy/rbac.yaml $ k apply -f deploy/operator.yaml
  47. 47. @jorgemoralespou / @grahamdumpleton 7. Deploy your own kubernetes applications $ cat <<EOF | k apply -f - kind: ProductionReadyDatabase apiVersion: database.example.com/v1alpha1 metadata: name: my-production-ready-database spec: clusterSize: 3 version: v4.0.1 EOF
  48. 48. @jorgemoralespou / @grahamdumpleton Also ansible
  49. 49. @jorgemoralespou / @grahamdumpleton Also helm Add Charts
  50. 50. @jorgemoralespou / @grahamdumpleton Taste it!
  51. 51. @jorgemoralespou / @grahamdumpleton apiVersion: etcd.database.coreos.com/v1beta2 kind: EtcdCluster metadata: name: example-etcd-cluster spec: size: 3 version: "3.3.9" etcd Operator
  52. 52. @jorgemoralespou / @grahamdumpleton etcd Operator 3.3.8 3.3.8 3.3.9
  53. 53. @jorgemoralespou / @grahamdumpleton
  54. 54. @jorgemoralespou / @grahamdumpleton apiVersion: sample.database.coreos.com/v1 kind: CompliantDatabase metadata: name: example-db spec: replicationFactor: 2 autoscale: true backup: hourly geography: restriction: EU preference: Germany Database
  55. 55. @jorgemoralespou / @grahamdumpleton Operators in OpenShift 4
  56. 56. @jorgemoralespou / @grahamdumpleton Helpful resources
  57. 57. @jorgemoralespou / @grahamdumpleton Resources ● Operator Framework and SDK on Github https://github.com/operator-framework/ ● Operator Hub https://www.operatorhub.io ● Operators resources/blogs https://coreos.com/operators/ https://blog.openshift.com/category/technologies/operators/
  58. 58. Interactive Learning Portal: Operators tutorials https://learn.openshift.com/operatorframework/
  59. 59. Automating with Operators Thanks for attending Graham Dumpleton Red Hat @grahamdumpleton Jorge Morales Red Hat @jorgemoralespou

×