Cloud Technology Community Question

What are the best practices for managing secrets in Kubernetes for a secure DevSecOps workflow?

Posted on 2024-09-22 • In Cloud Technology • By Jennifer Lopez

We are currently migrating our microservices to a production Kubernetes cluster and are concerned about the security of our sensitive data like API keys, database credentials, and TLS certificates. Currently, we are using standard K8s Secrets, but we’ve realized they are only base64 encoded and not actually encrypted at rest by default. In a DevSecOps model, where we aim for high automation and "least privilege" access, what is the industry standard for external secrets management? Should we look into HashiCorp Vault, or are cloud-native solutions like AWS Secrets Manager or Azure Key Vault sufficient for a cross-functional team? We need a solution that integrates well with our CI/CD and doesn't require manual intervention during pod scaling or deployments.

3 Answers 8,788 Views

All answers to this question 3 Answers

Emily Davis Answered on 2024-09-22
Answered

While Kubernetes Secrets are a start, for enterprise DevSecOps, you really should implement the "External Secrets Operator" or "Secrets Store CSI Driver." These allow K8s to pull secrets directly from providers like AWS Secrets Manager or HashiCorp Vault. If you are already heavily invested in a specific cloud provider, their native secret manager is usually sufficient and easier to manage regarding IAM roles. However, if you are running a multi-cloud or hybrid environment, HashiCorp Vault is the gold standard because of its robust auditing, dynamic secret generation, and platform-agnostic nature.

Christopher Brown Answered on 2024-09-24
Answered

Are you planning to use dynamic secrets, where the credentials are created on-the-fly and expire automatically, or just static keys? This choice significantly changes which tool is better for your team.

James Wilson Commented on 2024-09-25
Commented

We are leaning towards static keys for now to simplify the migration, but the security team is pushing for dynamic secrets for our RDS databases. If we go with HashiCorp Vault, the setup is more complex but the 'lease' functionality essentially eliminates the risk of leaked long-lived credentials. It's a bit of a trade-off between implementation speed and long-term security posture

Patricia Taylor Answered on 2024-09-26
Answered

For most teams, using the Secrets Store CSI driver with AWS or Azure is the path of least resistance. It mounts secrets as volumes, which is much more secure than environment variables.

Jennifer Lopez Commented on 2024-09-27
Commented

Patricia is right. Using the CSI driver to mount secrets as files prevents them from being accidentally logged in the container's environment, which is a common but dangerous DevSecOps pitfall.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.