Workshop: How to design a Kubernetes/Openshift Operator
In this post, we will see the process of designing an operator for your product with hands-on experience. This post is for people who are familiar with the operator pattern & may have tried operator-sdk/kubebuilder. If you aren’t please read my other post: Operator Pattern: Kubernetes/Openshift
The main challenge for people who are somewhere in the beginner/intermediate level. They have tried the getting started example, yet writing a working operator for their own product is still a learning curve. After this going through the workshop scenario. You will be able to achieve that goal.
Let’s break down the process of writing an operator into simple steps
- Define the product
- Identify the goals of the Operator
- Implementation using operator-sdk
Understand them one by one.
Define the product: (Kubernetes Lingo: Templates)
My goal for this step is to make your product deployable in Kubernetes/Openshift.
- Spec: Configurable parameters
- Container Packaging
I am taking an out of the box Quarkus application. Which will be our demo product. It is a simple application that runs over port: 8080 with a simple HTML page & hello rest end-point. It can be any product of your choice.
The reason, I have taken Quarkus is that with a dependency addon
quarkus-openshift. It lets you generate the Yaml/JSON files for making it deployable in Kubernetes/Openshift easily.
When I run the application build commands, I will see under the target folder: Templates like Deployment Config, Service, & Route, etc
Now even you have a try deploying your application for ensuring you have all the pieces required.
Identify the goals of the Operator
- Create: Instance when (A user creates the Custom Resource type of demo product) & where required (which namespace you want to deploy it)
- Watch: for events (Modification in the resource: route, spec/status, service, etc)
- Reconcile: Modification/Recreation (Action you want to take when the event happens)
Katacoda Scenario: This scenario will give you a hands-on experience of the process we just discussed above. (Sign-up is required)
How to design a Kubernetes/Openshift Operator | akoserwal | Katacoda
Learn to design a Kubernetes/Openshift Operator for your product using golang
Thank you for reading this article. If you like this post, please give a Cheer!!! Follow the Collection: operators for learning more…
Happy Coding ❤