有点囫囵吞枣的意思,找时间写一个简单的operator就能上手了
官方链接:https://kubernetes.io/docs/concepts/extend-kubernetes/operator/#what-s-next
四种方式
KUDO
- 相关链接:https://kudo.dev/
- 基本概念
- KUDO is a toolkit that makes it easy to build Kubernetes Operators, in most cases just using YAML.
- It provides a set of pre-built Operators, that you can use out of the box or easily customize.
- Finally, KUDO lets you standardize the way you run Operators.
kubebuilder
- 相关链接:https://book.kubebuilder.io/introduction.html
- github链接:https://github.com/kubernetes-sigs/kubebuilder
- 相关概念
- Kubebuilder is a framework for building Kubernetes APIs using custom resource definitions (CRDs).
- Note: kubebuilder does not exist as an example to copy-paste, but instead provides powerful libraries and tools to simplify building and publishing Kubernetes APIs from scratch.
- 需要安装开发环境:golankubebuilder
- Create a new project directory
- Create one or more resource APIs as CRDs and then add fields to the resources
- Implement reconcile loops in controllers and watch additional resources
- Test by running against a cluster (self-installs CRDs and starts controllers automatically)
- Update bootstrapped integration tests to test new fields and business logic
- Build and publish a container from the provided Dockerfile
Matacontroller along with WebHooks
- 相关链接:https://metacontroller.app/
- 知乎链接:https://zhuanlan.zhihu.com/p/73036278
- 相关概念
- Metacontroller是一个方便编写和部署自定义控制器的Kubernetes的插件。
自定义的资源描述了新的类型的对象是如何存储的,自定义的控制器描述了针对Kubernetes API扩展的行为。
- Metacontroller是一个方便编写和部署自定义控制器的Kubernetes的插件。
operator framework(现阶段比较成熟)
- 相关链接:https://github.com/operator-framework/getting-started
- 相关概念:
- Build an operator using the Operator SDK
- The Operator SDK makes it easier to build Kubernetes native applications, a process that can require deep, application-specific operational knowledge.
- 需要安装:
- Operator SDK
- 集群中安装 the Operator Lifecycle Manager:图形化的管理界面,具体可以看这个链接https://github.com/operator-framework/operator-lifecycle-manager
- Build an operator using the Operator SDK