Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes pod cannot see secret set with kubectl?

So, i have a k8s cluster running on AWS, provisioned using kops. I have created a secret locally, using kubectl:

    kubectl create secret generic aws-es --from-file=./aws_key.txt --from-file=./aws_secret_key.txt

My service.yml has this env:

    - name: AWS_ACCESS_KEY_ID
        valueFrom:
          secretKeyRef:
            name: aws-es
            key: aws_key

And when i update the service in the cluster with:

    kubectl apply -f service.yml

I get the error running pod:

     Error: secrets "aws-es" not found
     Error syncing pod 

Obviously, my kops installation cannot see the locally created secret, is there a way for me to propagate that secret to kops' s3 storage?

like image 274
dgmt Avatar asked Mar 05 '18 13:03

dgmt


1 Answers

Fixed it. The problem was i created secrets in default namespace, while my pods were running in kube-system namespace.

like image 180
dgmt Avatar answered Sep 19 '22 12:09

dgmt