External Secrets Operator is a Kubernetes operator that integrates external secret management systems like AWS Secrets Manager, HashiCorp Vault, Google Secrets Manager, Azure Key Vault and many more. The operator reads information from external APIs and automatically injects the values into a Kubernetes Secret. Instead of storing sensitive information directly in Kubernetes Secrets, which are base64 encoded but not encrypted, External Secret Operator allows you to manage these secrets externally and inject them into your Kubernetes environment as needed.
Before you begin, ensure you have the following:
helm repo add external-secrets https://charts.external-secrets.io
helm install external-secrets \
external-secrets/external-secrets \
-n external-secrets \
--create-namespace \
# --set installCRDs=false
NOTE: If you do not want the CRDs to be automatically upgraded and managed, you must set the installCRDs option to false. (e.g. –set installCRDs=false).
To securely store and manage secrets, follow these steps to create a secret in AWS Secrets Manager:
To enable a Kubernetes cluster to securely access AWS Secrets Manager, follow these steps to create an IAM role with appropriate permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetResourcePolicy",
"secretsmanager:GetSecretValue",
"secretsmanager:DescribeSecret",
"secretsmanager:ListSecretVersionIds"
],
"Resource": [
""
]
}
]
}
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
eks.amazonaws.com/role-arn:
name: my-serviceaccount
kubectl apply -f serviceaccount.yaml
kubectl get serviceaccount my-serviceaccount
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam:::oidc-provider/"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
":aud": "sts.amazonaws.com",
":sub": "system:serviceaccount::"
}
}
}
]
}
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: secretstore-sample
spec:
provider:
aws:
service: SecretsManager
region:
auth:
jwt:
serviceAccountRef:
name:
namespace:
kubectl apply -f clustersecretstore.yaml
apiVersion: external-secrets.io/v1alpha1
kind: ExternalSecret
metadata:
name:
spec:
secretStoreRef:
name:
kind: ClusterSecretStore
target:
name:
data:
- secretKey:
remoteRef:
key:
property:
- secretKey:
remoteRef:
key:
property:
helm repo add stakater https://stakater.github.io/stakater-charts
helm repo update
helm install reloader stakater/reloader --set watchGlobally=true
kind: Deployment
metadata:
annotations:
reloader.stakater.com/auto: "true"
spec:
template:
metadata:
A reliable and safe way to manage Kubernetes secrets is to integrate the External Secret Operator with AWS Secrets Manager. This integration makes it easier to manage secrets and improves security by enabling smooth access to secrets kept in AWS. This integration supports a safe and effective DevOps environment while streamlining operations and lowering the risk of confidential information being revealed.