Retrieve EKS Secret Using A Pod With Jupyterlab Retrieve EKS Secret Using A Pod With Jupyterlab kubernetes kubernetes

Retrieve EKS Secret Using A Pod With Jupyterlab


The secrets are really volumes mounted on your Pod. So you can access them that way. So depending where you are mounting the secret you can just the filename.

For example:

apiVersion: v1kind: Secretmetadata:  name: mysecrettype: Opaquedata:  username: xxxx  password: xxxx

and the Pod

apiVersion: v1kind: Podmetadata:  name: mypodspec:  containers:  - name: mypod    image: redis    volumeMounts:    - name: foo      mountPath: "/etc/foo"      readOnly: true  volumes:  - name: foo    secret:      secretName: mysecret

You can see the content:

cat /etc/foo/data

If it's Opaque you can decode it with base64

cat /etc/foo/data | base64 -d

✌️