k8s operator开发与使用
本篇文章用于记录k8s operator的开发,此处以一个简单的demo来记录operator的开发过程及相关要点;本文中使用kubebuilder工具来生成相关代码
一、创建项目及初始化
#新建demo-operator的目录 [root@k8s-node4 data]# mkdir demo-operator [root@k8s-node4 data]# cd demo-operator/ #Create a kubebuilder project, which requires an empty folder [root@k8s-node4 demo-operator]# go mod init demo-operator go: creating new go.mod: module demo-operator [root@k8s-node4 demo-operator]# kubebuilder init --domain github.io Writing kustomize manifests for you to edit... Writing scaffold for you to edit... Get controller runtime: $ go get sigs.k8s.io/controller-runtime@v0.14.1 Update dependencies: $ go mod tidy Next: define a resource with: $ kubebuilder create api
标签:demo,go,开发,operator,k8s,root,kubebuilder From: https://www.cnblogs.com/wushaoyu/p/17155300.html