AKS Secret security

Chew Kok Hoor 30 Reputation points
2023-08-12T01:39:51.46+00:00

If I mount an AKS Secret using the 'secrets-store.csi.k8s.io' driver, is it better to mount it as a file or environment variable?

How do I prevent anyone using 'kubectl exec' to see the file / variable? Can I remove the environment variable after retrieving it using 'unset'? Or are there any other recommended method to secure the secret keys away from prying eyes?

Thanks in advance.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,372 questions
0 comments No comments
{count} votes

Accepted answer
  1. AirGordon 7,145 Reputation points
    2023-08-12T07:54:27.4+00:00

    It's generally accepted that mounting as files is more secure that by environment variable.

    For more information, see this SO post with some good discussion and references; https://stackoverflow.com/questions/51365355/kubernetes-secrets-volumes-vs-environment-variables


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.