Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot list secrets in namespace when created using kubeseal #1384

Closed
AhaanShetty opened this issue Nov 17, 2023 · 5 comments
Closed

Cannot list secrets in namespace when created using kubeseal #1384

AhaanShetty opened this issue Nov 17, 2023 · 5 comments

Comments

@AhaanShetty
Copy link

AhaanShetty commented Nov 17, 2023

Which component:
The name (and version) of the affected component (controller or kubeseal)
Controller
kubeseal version 0.24.3

Describe the bug
I created a sealed secret using the kubeseal command and have the necessary controller and other components successfully installed using a helm chart. Now when I run "kubectl get sealedsecrets", it shows the secret I just created but upon running "kubectl get secrets", it doesn't show up under there. I thought that as soon as a sealed secret is deployed, a regular secret and a sealed secret should be created. The logs from the controller are in the output section of this issue.
I have deployed kubeseal in the cluster in my namespace and using the restrictive encviornment instructions. I set the serviceaccount to one that is enabled for our namespace but seems like the undelying container is calling the cluster wide scope even though it has been deployed to only our namespace.
Our cluster admins do not allow crossing the namespace boundary. The code is written to list secrets at the cluster scope even though I am deploying using the restricted environment instructions. The service account also has the correct verbs in the cluster role API groups for the secrets-unsealer container. Kindly help with the same

To Reproduce
Steps to reproduce the behavior:

Expected behavior
The newly created secret using kubeseal should show up under sealedsecrets and secrets CRD but only the sealedsecrets CRD can be listed. The controller is unable to unseal the secret into the regular type

Version of Kubernetes:

  • Output of kubectl version:
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.23.6

Helm Chart

NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
sealed-secrets  security        1               2023-11-16 14:14:52.801967432 -0500 EST deployed        sealed-secrets-1.5.10   0.24.3
E1117 17:53:12.679668       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.28.3/tools/cache/reflector.go:229: Failed to watch *v1.Secret: failed to list *v1.Secret: secrets is forbidden: User "system:serviceaccount:security:admin-security" cannot list resource "secrets" in API group "" at the cluster scope
W1117 17:53:56.496632       1 reflector.go:535] pkg/mod/k8s.io/client-go@v0.28.3/tools/cache/reflector.go:229: failed to list *v1.Secret: secrets is forbidden: User "system:serviceaccount:security:admin-security" cannot list resource "secrets" in API group "" at the cluster scope
E1117 17:53:56.496669       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.28.3/tools/cache/reflector.go:229: Failed to watch *v1.Secret: failed to list *v1.Secret: secrets is forbidden: User "system:serviceaccount:security:admin-security" cannot list resource "secrets" in API group "" at the cluster scope
W1117 17:54:05.600514       1 reflector.go:535] pkg/mod/k8s.io/client-go@v0.28.3/tools/cache/reflector.go:229: failed to list *v1alpha1.SealedSecret: sealedsecrets.bitnami.com is forbidden: User "system:serviceaccount:security:admin-security" cannot list resource "sealedsecrets" in API group "bitnami.com" at the cluster scope
E1117 17:54:05.600542       1 reflector.go:147] pkg/mod/k8s.io/client-go@v0.28.3/tools/cache/reflector.go:229: Failed to watch *v1alpha1.SealedSecret: failed to list *v1alpha1.SealedSecret: sealedsecrets.bitnami.com is forbidden: User "system:serviceaccount:security:admin-security" cannot list resource "sealedsecrets" in API group "bitnami.com" at the cluster scope

Additional context
Add any other context about the problem here.

@AhaanShetty AhaanShetty added the triage Issues/PRs that need to be reviewed label Nov 17, 2023
@tewfik-ghariani
Copy link
Contributor

This could be the same as #1091 / #1064

There was a feature added that allows the operator to watch the secrets and track their deletion in order to recreate them automatically

I faced the same issue and I had to disable that feature by setting skipRecreate to false

Ref: https://github.com/bitnami-labs/sealed-secrets/blob/main/helm/sealed-secrets/values.yaml#L63C1-L68C20

@AhaanShetty
Copy link
Author

Thanks for the reply @tewfik-ghariani . The issue is that I am able to create sealed secrets but when I do, it does not create regular ones and the above output was in the controller logs. Nevertheless I will install the controller using the option that you suggested

@agarcia-oss
Copy link
Member

agarcia-oss commented Nov 23, 2023

Hi @AhaanShetty Installing the Sealed Secrets controller in a restricted environment can be challenging sometimes. The problem, as you can see in the controller logs, the problem is that you don´t have permission to list sealedsecrets with cluster scope.
I recommend you take a look at our documentation on how to deploy Sealed Secrets in a restricted environment.

Also, you should define the namespaces where the controller must work using the --additional-namespaces flag.

@agarcia-oss agarcia-oss added question and removed triage Issues/PRs that need to be reviewed labels Nov 23, 2023
Copy link
Contributor

github-actions bot commented Dec 9, 2023

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the Stale label Dec 9, 2023
Copy link
Contributor

Due to the lack of activity in the last 7 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants