Home > front end >  Want to create a custom controller
Want to create a custom controller

Time:01-09

I'm here to ask for a help. I want to create a custom controller for my custom resource and literally I have no idea how and from where to start, like from where golang script will run for controller and how my custom resource will be useful.

So, I need some help like how I can start and from where I should start.

Thanks in advance

Deepak

CodePudding user response:

When using Go, the kubebuilder is a good start for creating Kubernetes controller and custom resource. The Kubebuilder online book is a good tutorial to follow, to learn the components of the controller and the kubebuilder SDK.

CodePudding user response:

As Jonas suggested you can go for Kubebuilder or Operator SDK is also a good option.

i won't suggest writing the custom controller until it's not required as you have now to manage the code, versions etc.

Instead you checkout the existing controller or application like the Kubewatch, which also do the same job for you.

Kubewatch check the K8s events and based on that send the slack message.

Checkout my article : https://medium.com/@harsh.manvar111/kubernetes-event-notifications-1b2fb12a30ce

If you have a requirement to write custom code you can simple make own Deployment with client library, which will look for the event of K8s

Check out my Github repo : https://github.com/harsh4870/Slack-Post-On-POD-Ready-State

Which checks for the POD ready statement and sends the slack notification, you can re-write that python code to Go as per need.

  • Related