-
Hello, hope you're good. I'm looking for something that could automate the provisioning and management of Deployments/Services/Secrets and other Kubernetes resources dynamically. My idea was to create a custom controller for that, but all the examples I find they use the controller along with a custom entity, which is a static file. I was thinking that this controller would run like a cron job, checking from time to time the database state and compare to what is hosted in the cluster. It would basically create and destroy the resources. Do you think this idea makes sense (keep going with the custom controller)? If not, what you recommend? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @64J0 This is not the "Kubernetes" way, nor are operators built for such tasks. The state should be a desired state and documented in the Kubernetes API. So, if you change a resource, that will update your other objects. You can either create your custom resource for such things, or have a database, but anyway, you'll need a running controller for this. To fully use an operator, you should use existing resources (you can attach an operator to a V1Deployment if you want), or really create a cronjob that does what you stated, but then you won't need an operator. The normal Kubernetes client is sufficient to execute these tasks for you. |
Beta Was this translation helpful? Give feedback.
Hey @64J0
This is not the "Kubernetes" way, nor are operators built for such tasks.
The state should be a desired state and documented in the Kubernetes API. So, if you change a resource, that will update your other objects.
You can either create your custom resource for such things, or have a database, but anyway, you'll need a running controller for this.
To fully use an operator, you should use existing resources (you can attach an operator to a V1Deployment if you want), or really create a cronjob that does what you stated, but then you won't need an operator. The normal Kubernetes client is sufficient to execute these tasks for you.