Hello everyone! I'm part of the operations team overseeing some Kubernetes clusters. The development team has requested to install and manage the CloudNativePG operator within a specific namespace so they can deploy PostgreSQL for their development needs. However, this raises concerns regarding the necessary cluster role for managing the Custom Resource Definitions (CRDs), which is against our company's policy. I'm looking for alternative ways to enable the developers to self-manage the CloudNativePG operator while adhering to the least privilege principle. Any suggestions?
5 Answers
Consider leveraging tools like Kyverno or OPA to restrict the namespaces where they can deploy the CloudNativePG operator. This could help enforce your least privilege approach.
I think it's best for your team to manage the operator. The developers should be focusing on utilizing it rather than operating it themselves.
Yes, the easy route is to limit their permissions to just the Custom Resources and ConfigMaps. This allows them to create and configure managed clusters without giving them broader access, and they won’t need to interact with the cnpg-system namespace either. You can handle the operator management while they just focus on their own resources.
One option is to provide the developers with a 'fake' cluster that they can fully own without any access to the real one. At a previous company, we used vCluster to create virtual Kubernetes clusters for development teams. This way, they had the freedom to install CRDs and Operators without affecting the main cluster. It alleviates the headaches of managing multi-tenancy as they can do whatever they want on their virtual environment!
You don’t have to use the service account and cluster role that comes with the CloudNativePG Helm chart. You can create your own service account and attach it directly to the pod instead. This gives you more control over what they can access.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures