I created a secret in kubernetes using the command below -
kubectl create secret generic -n mynamespace test --from-file=a.txt
Now I try to view it using below commands but am unsuccessful -
kubectl describe secrets/test
kubectl get secret test -o json
This is the error I get in either case -
Error from server (NotFound): secrets "test" not found
What can be the cause? I am using GCP for the kubernetes setup. Can the trial version of GCP be the cause for it?
Try to access the secret in the namespace where it was created in:
kubectl -n mynamespace describe secrets/test
kubectl -n mynamespace get secret test -o json
You create your secret on a specific namespace and not the default one and when you use kubectl describe
it will be bind to the default one.
Good thinks to know when you use a specific namespace for your secret is that they can only be referenced by pods in that same namespace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With