Open bpvcode opened 3 years ago
Have you checked the events on the dev1 sealed secret? Perhaps there are some useful errors?
Why do you need more instances of controller in single k8s cluster?
Let's say you have a multitenant environment. You don't want sealed secret for tenant1 to be able to decrypt secrets for tenant2. So sealed secrets needs to be able to be restricted to a (set of) namespace(s), and be able to be deployed multiple times in the same cluster.
https://github.com/bitnami-labs/sealed-secrets#scopes
unless you set cluster-wide
scope, you can't decrypt secret from other namespace.
unless you set cluster-wide scope, you can't decrypt secret from other namespace.
Yes, but in this case they want to have two separate SealedSecrets and Secrets in the dev
and dev1
namespaces – and in fact are creating those in step 3.
@rouke-broersma have you tried including the --namespace
argument to kubeseal in step 3? You'll need to specifically generate the SealedSecret with the correct namespace in metadata.namespace
and spec.template.metadata.namespace
, unless you want to do the cluster-wide thing as suggested by @dosmanak .
I was only explaining why you might want multiple controllers in 1 clusters.
@rouke-broersma sorry I tagged the wrong person; @bpvcode I meant to suggest the --namespace
argument to you.
Explanation
I want to store my database credentials in sealed secret files. I'm trying to have sealed secrets for each namespace (dev, dev1). I'm using
skaffold
andkustomize
to deploy to my remote k8s cluster.1º Install the controller inside cluster for each namespace
I run the commands:
Path:
overlays/dev
Path:
overlays/dev1
Is the same as you run this
kubectl apply --filename https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.16.0/controller.yaml
but with the respective namespaces(dev
,dev1
) for each file, instead ofkube-system
At this point,
sealed-secret-controller
has been created for both namespaces in remote k8s2º Fetch cert
Path:
overlays/dev
Path:
overlays/dev1
At this point, in each path i have a
cert.pem
file.3º Generate sealed secret
Path:
overlays/dev
Path:
overlays/dev1
At this moment, i have two different
SealedSecret
files, one in each path. The difference is thenamespace
and the encrypted data, although is the sameKey : value
pairs.4º Apply sealed secret for dev namespace
Path:
overlays/dev
Output:
If i run:
Output:
At this point the
postgres-secret
was created and if i output in yaml format i am able to see the data withkey : value
pairs in base 64 encoded.5º Apply sealed secret for dev1 namespace
Path:
overlays/dev1
Output:
If i run:
Output:
NOTE: The
postgres-secret
was not created in this namespaceExpected behavior
Should create a new
postgres-secret
for each namespace, but doesn't, only create for the first namespace. Both have the same name and data, the only thing that is different is the namespaceAdditional Information
Kubeseal version: v0.16.1-0.20210512081140-62cfb264f53e Operating system: Pop!_OS 20.04