Skip to content

Bash script to inject AWS Secrets Manager Secrets into Kubernetes secrets

Notifications You must be signed in to change notification settings

snobear/inject-k8s-secrets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

inject-k8s-secrets

This is a bash helper script that:

  • Retrieves AWS Secrets Manager Secrets with the aws cli under a given prefix
  • Converts the secret name format into Kubernetes-friendly naming
  • Inject the secrets into the k8s cluster using kubectl

See my related article: Injecting Secrets from AWS Secrets Manager into Kubernetes

Usage

./inject.sh secret_prefix cluster namespace region profile

Example

./inject.sh myapp/dev foocluster app us-west-2 someawsprofilename

Injecting all secrets under myapp/dev from AWS Secrets Manager into cluster foocluster, namespace app

AWS Secret name                                   ----> k8s Secret Name
====================                                    ====================
myapp/dev/api/db/dbpass                                 api-db-dbpass
myapp/dev/api/api_key_foo                               api-api-key-foo
myapp/dev/parser/backend/redis-pw                       parser-backend-redis-pw

About

Bash script to inject AWS Secrets Manager Secrets into Kubernetes secrets

Topics

Resources

Stars

Watchers

Forks

Languages