[Kubernetes][Kubebuilder] New Grafana dashboard plugin for visualizing controller-runtime metrics #572
Replies: 3 comments 1 reply
-
Following is the summary of questions raised so far. I hope this introduction helps in getting to know the project better. FAQ💁♀️ What is Kubebuilder? How is it used?Kubebuilder is often used as a CLI tool that generates projects and provides features to help people create "Operator Solutions". TL'DR: All Operators are made of controllers, but not all sets of controllers are operators. Operators are sets of controllers that encode human operational knowledge for a specific application (e.g. the Prometheus Operator). Controllers are more general -- for instance, the namespace service account controller isn't an operator because it doesn't have knowledge of a specific application -- it's very general. Kubebuilder helps constructs sets of controllers. Some of those are Operators, some might not be. Also, Kubebuilder can be used as a lib to help other projects extend their features and/or create nice plugins which can be used as specific helpers. For example, Operator-SDK uses Kubebuilder and scaffolds the same plugins/projects and also provides additional features and others plugins on top of it. See: Readme Overview 💡 Examples of its usage:See https://operatorhub.io/ to have a better idea ❓ Why Operators?By using operators, it’s not only possible to provide all expected resources but also to manage them dynamically, programmatically, and at execution time. To illustrate this idea, imagine if someone accidentally changed a configuration or removed a resource by mistake; in this case, the operator could fix it without any human intervention. ❓ What is Controller Runtime?The controller-runtime library provides various abstractions to watch and reconcile resources in a Kubernetes cluster via CRUD (Create, Update, Delete, as well as Get and List in this case) operations. Operators use at least one controller to perform a coherent set of tasks within a cluster, usually through a combination of CRUD operations. It is leveraged by Kubebuilder and Operator SDK. A quick read through on controller-runtime APIs can be found here: https://sdk.operatorframework.io/docs/building-operators/golang/references/client/ 🤔 What is the motivation behind this project? Why create a dashboard for metrics?The controller-runtime library, by default, builds a global prometheus registry and publishes a set of metrics which give insight on the controller’s performance. Any operator which is built using Kubebuilder can publish the same set of metrics and visualize them. It would be helpful if we can provide a plugin that scaffolds the manifests required to visualize these metrics on the grafana dashboard, so that operator authors can benefit from them. An extended goal would be to add this dashboard and make it available in the Grafana dashboards marketplace. Suggested approach to this problem:What we need are manifests with which users can wire in their own monitoring stack (grafana and/or prometheus) and observe the metrics. For example, in the current implementation, we create manifests for exposing metrics though kustomize that helps in deploying a service-monitor and service for exposing metrics. With this, users can wire in the service-monitor along with prometheus (from their own monitoring stack) and observe metrics. So the idea is to create a generic solution using the plugin architecture that scaffolds manifests to visualize metrics using grafana. There are always better ideas and solutions! Please feel free to suggest an alternative in the proposal which you think will make it easier for Kubebuilder users to visualize controller-runtime metrics on grafana dashboards. 💁♀️ How to know more about the plugins and how to write them?See the doc: https://book.kubebuilder.io/plugins/plugins.html ⬆️ A little bit more on plugins! How can I provide the flags for the plugins? Where are they defined?In the plugin layout, we have some interfaces for the commands like kubebulder init [OPTIONS], kubebulder create API [OPTIONS], kubebulder edit [OPTIONS], kb create webhooks [OPTIONS].
Then see that we are binding the flags for each subCommand implementation, e.g.
🚀 How do I familiarize with the project?OpenSource projects usually have a Contribution guide, see CONTRIBUTING and also VERSIONING for further details. Feel free to check the open issues in the project and begin to work and contribute with anything that you find interesting. The maintainers actively manage the issues list and try to highlight issues suitable for newcomers (You can filter by good+first+issue also contributions to help on the docs can fit well for the first ones) but you are free to help as it pleases you. The project follows the typical GitHub pull request model. Before starting any work, please either comment on an existing issue or file a new one. ✋ How to get help?Feel free to ping us and join the #kubebuilder channel in the kubernetes.slack.com slack. 👋 More on community meetingsKubebuilder and Controller-runtime are a part of API Machinery Special Interests Group. The details on community meetings are present here: https://github.com/kubernetes/community/blob/master/sig-list.md Operator SDK is a part of Operator Framework community. Details on SDK community meetings are here: https://github.com/operator-framework/community#operator-sdk-working-group Students reached out so far |
Beta Was this translation helpful? Give feedback.
-
Hey, @varshaprasad96 , thx for providing the rich context! I also curious about some certain points:
|
Beta Was this translation helpful? Give feedback.
-
@Kavinjsir Thanks for brining up these questions! Answering them below:
|
Beta Was this translation helpful? Give feedback.
-
Your goal is to develop a Kubebuilder Plugin which will generate the manifests required to provide Grafana dashboards for visualizing the default metrics exported. You can begin by first looking into the requirements for exporting the controller-runtime metrics and steps to create a custom dashboard. After figuring out the configuration files which are needed, we can start by creating a plugin when invoked scaffolds them. The plugins here can give a good idea on how they work. An extended goal would be to figure out on how we can make it available on https://grafana.com/grafana/dashboards for users to be able to easily export it.
Mentor(s): Varsha Prasad (@varshaprasad96)
https://github.com/cncf/mentoring/blob/main/summerofcode/2022.md#new-grafana-dashboard-plugin-for-visualizing-controller-runtime-metrics-size-medium
Beta Was this translation helpful? Give feedback.
All reactions