Kubernetes Secrets: How We Leaked API Keys (And Fixed It)
Found our AWS access keys in a public GitHub repo last month. Fun times. Here’s how it happened and what we actually did to prevent it. How we leaked them Developer needed to add an API key to a Kubernetes service. Did this: # deployment.yaml - DON'T DO THIS apiVersion: apps/v1 kind: Deployment metadata: name: api-service spec: template: spec: containers: - name: api env: - name: AWS_ACCESS_KEY value: "AKIAIOSFODNN7EXAMPLE" # 🚨 Plaintext in git! - name: AWS_SECRET_KEY value: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" Committed it. Pushed it. Public repo. Keys were active for 6 hours before AWS alerted us to unusual activity. ...
