使用Operator-SDK构建基于Helm 的 Operator

步骤

创建一个项目目录并初始化项目

# mkdir geth-operator
# cd geth-operator
# operator-sdk init --domain example.com --plugins helm

根据本地helm chart 包创建简单api

# operator-sdk create api \
      --helm-chart=/Users/liujinye/github/helm-charts/geth-0.2.4.tgz

构建operator镜像并push到仓库

make docker-build docker-push IMG="registry.example.com/geth/geth-helm-operator:v0.0.3"

因默认的gcr.io 仓库国内不能访问,修改默认 config/default/manager_auth_proxy_patch.yaml 中 image 如下

				...
        image: gcr.dockerproxy.com/kubebuilder/kube-rbac-proxy:v0.11.0
        ...

OLM 部署

安装 olm

bundle operator

制作operator bundle镜像并推送到仓库

使用operator bundle 部署operator

创建示例 Geth 自定义资源

卸载operator

直接部署

部署operator

创建示例 Geth 自定义资源

卸载operator

参考

https://sdk.operatorframework.io/docs/building-operators/helm/

https://sdk.operatorframework.io/docs/installation/

https://kind.sigs.k8s.io/docs/user/configuration/

https://sdk.operatorframework.io/docs/olm-integration/tutorial-bundle/

https://sdk.operatorframework.io/docs/olm-integration/cli-overview/#private-bundle-and-catalog-image-registries

Last updated