With the operator-sdk guide v1.0, it is necessary to install operator-sdk in production environment when deploy an operator.

Is it possibile to deploy an operator without installing operator-sdk? Because it leads to more dependency and complexity.

How can I just generate CRD yaml, CR yaml and Contoller Image? Or any other more convenient way to publish an Operator?

2

There are 2 answers

0
Shmuel On

You can change the make deploy command to generate deploy.yaml with all rbac and deployment objects needed for the operator. I struggle with my self until I found this solution.

Just change the deploy task in the make file.

$(KUSTOMIZE) build config/default | kubectl apply -f -

To

$(KUSTOMIZE) build config/default > deploy.yaml

Then run make deploy. And then copy the deploy.yaml and install it in your k8s or create a helm chart from it. This worked for me no need for operator-sdk in your environment.

Edit:
I didn't use CRD i use it to watch existing resources. But it's look like the same solution should work with the install task for CRD and CR.

3
asmacdo On

The operator-sdk is not intended to directly run operators in production. Instead, you should run your operator as a Deployment inside the cluster. https://v1-0-x.sdk.operatorframework.io/docs/building-operators/golang/tutorial/#2-run-as-a-deployment-inside-the-cluster