In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to use CRD to build the SDK of Kubernetes API in Kubebuilder, the content is very detailed, interested friends can refer to, hope to be helpful to you.
How can we get applications like MySQL, Spark, and Cassandra to manage ourselves, just like Kubernetes Deployments and Pods? How do we configure these applications as our first type of API instead of a collection of StatefulSets, Services, and ConfigMaps?
We have been working on the solution to this problem and are pleased to launch kubebuilder. This is a comprehensive development kit that uses CRD to quickly build and release Kubernetes API and controllers. Kubebuilder supports project and API definitions and is built on the controller-runtime library.
Why use Kubebuilder and Kubernetes API?
Applications and cluster resources usually require some action, whether to replace failed copies with new copies, or to scale the number of replicas when reanalyzing the data. Running MySQL applications may require scheduling backups, reconfiguring replicas after expansion, setting up fault detection and repair, and so on.
Using the Kubernetes API model, management logic is embedded directly into the application-specific Kubernetes API, for example, the "MySQL" API. Users then use tools such as kubectl to declaratively manage applications through YAML configuration, just as they do with Kubernetes objects. This method is called an application controller, also known as an Operator. Controller is a powerful technology that supports core Kubernetes API and can be used to build a variety of solutions other than applications, such as Autoscalers, Workload API, Configuration API, CI/CD systems, and so on.
However, while developers can build new controllers on top of the original API machine, doing so is a "scratch" DIY experience that requires developers to learn the low-level details of how to implement the Kubernetes library, write boilerplate code and build their own solutions for integration testing, RBAC configuration, documentation, etc. Kubebuilder makes this experience simple and easy by applying the lessons learned from building the core Kubernetes API.
Building an Application Controller and getting started with Kubernetes API
By providing structured solutions for creating controllers and Kubernetes API, developers can get a "out-of-the-box" experience using lessons learned and best practices from developing core Kubernetes API. Creating a new "Hello World" controller using kubebuilder is very simple:
-create a project: kubebuilder init
-define a new API:kubebuilder create api
-build and run the provided main function: make install & make run
This will generate API and Controller for users to modify, as well as integration tests, RBAC rules, DockerfilesMakefile, and so on. After the implementation code is written and added to the project, users create artifacts to publish their API by:
-build and push the container image from the provided Dockerfile: make docker-build & make docker-push
-deploy API:make deploy
Whether you're already a controller enthusiast or just want to know what it is, take a look at the kubebuilder code or the examples in the kubebuilder book to see how building controllers can be easy to use.
Kubebuilder is a project under SIG API Machinery, which is actively developed by contributors from Google, Red Hat, VMware, Huawei and many other companies.
The SDK about how to use CRD to build Kubernetes API in Kubebuilder is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.