Cloud Native Night, January 2018, Mainz: Talk by Jakob Karalus (@krallistic, IT Consultant at codecentric)
Join our Meetup: https://www.meetup.com/de-DE/Cloud-Native-Night
Abstract: While it's easy to deploy stateless application with Kubernetes, it's harder for stateful software. Since applications often require custom functionality that Kubernetes can't provide, developers want to add more specialized patterns like automatic backups, failover or rebalancing to their Kubernetes deployments. In this talk, we will look at the Operator Pattern and other possibilities to extend the functionality of Kubernetes and how to use them to operate stateful applications.
16. 16
• Extra Scheduling needs? -> Scheduler Extenders (Webhooks)
• More Advanced Scheduling Features -> Custom Schedulers
• Complex APIs beyond CRD -> Custom API Server with API Aggregation
• Control over what object can be created -> Admission Webhooks
• Control how objects should be initialized? -> Initializer
• Different Runtime needs? -> CRI, CNI
• Special Storage -> Flex Volumes, (CSI)
Not enough?
18. 18
• Helm itself a Operator (somewhat, working on it
https://github.com/kubernetes/helm/issues/3089) )
• Controllers
• Operator = Controller + CRD
• Operator = External Software
• Controller = Internal
• Only do operators if you cant solve it with Helm.
Operators vs Helm vs Controller
19. 19
• WATCH for updates
• Generator Controller
• Informer
• Create API Spec
• Generate some Objects needed by Informer etc (Since 1.8)
• See: https://blog.openshift.com/kubernetes-deep-dive-code-generation-
customresources/ (Excellent, by sttts)
• Main
Code!
20. 20
• Microservices, single Deployment
• Stateless, use CRD for States
• Operations should be Idempotent
• Leverage K8S Objects as most as possible
• CRD should be versioned, backwards compatible
Best Practice Operators
24. 24
Task Mesos Kuberentes
Custom Resource Placement Write a framework Write a custom scheduler
Special resource init Write a framework Initializer
API access Every Framework has its own API Unified API
Special lifecyle Write a framework Kubernetes Operator
Custom execution Write a framework + executioner CRI Interface + Scheduler
Comparison