You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all! I just found this repository, which seems to fit my need perfectly. I have an API that consists of multiple micro-services, but they all share the same domain. They are deployed in individual namespaces, and I need to replicate a Secret created by cert-manager to all those namespaces.
Push-based replication via label selector seems to be a perfect fit. I can simply label those namespaces.
However, looking at the Kubernetes manifests generated by the Helm chart, the permissions feels very excessive. The service account will have full permissions to read and write secrets in any namespace. This feels like a security risk.
Wouldn't it be possible to limit the service account so that it can only create and update secrets? Why would the push-based setup require read access?
Wouldn't it also be possible to limit the service account so it can only access secrets with a specific name?
Here is an example: deploy/helm-chart/kubernetes-replicator/templates/rbac.yaml (but with focus on secret and some variables replaced):
Of course, the service account still needs to be able to read and watch those secrets that are being replicated. But I guess that could be done separately, with Role and RoleBinding (in addition to the existing ClusterRole and ClusterRoleBinding), specifically in the namespace where the secrets (certificates) are. Something like this:
These are defined outside kubernetes-replicator, in the namespace that hosts my certificates/secrets:
---
kind: RoleapiVersion: rbac.authorization.k8s.io/v1metadata:
name: secrets-replicatornamespace: api-certificatesrules:
- apiGroups:
- ""resources:
- secretsverbs:
- get
- watch
- list
---
kind: RoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata:
name: secrets-replicatornamespace: api-certificatesroleRef:
kind: Rolename: secrets-replicatorapiGroup: rbac.authorization.k8s.iosubjects:
- kind: ServiceAccountname: <name of the service account for kubernetes-replicator>namespace:<namespace of kubernetes-replicator>
What do you think? Maybe I'm overthinking the whole thing? Would it even work? I guess there is nothing that stops me from setting this up myself, and simply just configuring kubernetes-replicator with that service account, via the Helm value serviceAccount.name. But maybe it would be a good thing to document it?
Any thoughts are appreciated!
The text was updated successfully, but these errors were encountered:
I would love it if kubernetes-replicator had support for specifying in which namespace it should watch for secrets in. In my case, I only need a single namespace, so that would be quite simple. I believe we could simply replace the "" empty string parameters to .Secrets("") to something that we configure as an argument to the application.
Hey all! I just found this repository, which seems to fit my need perfectly. I have an API that consists of multiple micro-services, but they all share the same domain. They are deployed in individual namespaces, and I need to replicate a
Secret
created by cert-manager to all those namespaces.Push-based replication via label selector seems to be a perfect fit. I can simply label those namespaces.
However, looking at the Kubernetes manifests generated by the Helm chart, the permissions feels very excessive. The service account will have full permissions to read and write secrets in any namespace. This feels like a security risk.
Wouldn't it be possible to limit the service account so that it can only create and update secrets? Why would the push-based setup require read access?
Wouldn't it also be possible to limit the service account so it can only access secrets with a specific name?
Here is an example:
deploy/helm-chart/kubernetes-replicator/templates/rbac.yaml
(but with focus onsecret
and some variables replaced):Of course, the service account still needs to be able to read and watch those secrets that are being replicated. But I guess that could be done separately, with
Role
andRoleBinding
(in addition to the existingClusterRole
andClusterRoleBinding
), specifically in the namespace where the secrets (certificates) are. Something like this:These are defined outside
kubernetes-replicator
, in the namespace that hosts my certificates/secrets:What do you think? Maybe I'm overthinking the whole thing? Would it even work? I guess there is nothing that stops me from setting this up myself, and simply just configuring
kubernetes-replicator
with that service account, via the Helm valueserviceAccount.name
. But maybe it would be a good thing to document it?Any thoughts are appreciated!
The text was updated successfully, but these errors were encountered: