DEV Community

Nabeel Sulieman
Nabeel Sulieman

Posted on

Connecting Kubernetes to AWS ECR

I'm pleased to announce the release of k8s-ecr-login-renew
(GitHub / Docker). It's a small tool written in Go that simplifies working with Amazon's Elastic Container Registry (ECR). It addresses the fact that ECR Docker login credentials expire every 12 hours. k8s-ecr-login-renew solves this by:

  • Fetching Docker login credentials from an AWS
  • Creating/Updating a Docker login secret in Kubernetes
  • Running as a cron job to prevent the Docker secret from expiring

The source code and Docker image are published here:

I'm also quite proud of the README and example code. My hope is that they will make getting started extremely easy.

Enjoy!

PS: Feedback is welcome and desired! Please also let me know if you found this tool useful (or if you had trouble using it).

Top comments (3)

Collapse
 
diestrin profile image
Diego Barahona

Nice tool. Would be nice to create a daemon that creates the cron job when a new namespace is created.

Collapse
 
walidshaari profile image
Walid Shaari

you mean a controller, in openshift there is a default project/namespace template that can capture this, wondering what is the best way to template this for namespace creations? could be a provisioning script/webhook or some sort of trigger.

Collapse
 
nabsul profile image
Nabeel Sulieman

The code has been updated a while back to support multiple namespaces from the same single cron job.