My question is the same of this question: k8s/python: How do I read a secret using the Kubernetes Python client? but from inside Kubernetes. I know how to access secrets from the outside with kubernetes python client.
But how do I access a secret in python when inside kubernetes? I have several python microservices, and they should all access secrets from within kubernetes.
According to the official documentation https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/#create-a-pod-that-has-access-to-the-secret-data-through-environment-variables I can create environmental variables. Would these variables then be accessible through import os; os["MY_VAR"]
?