Git Product home page Git Product logo

kube-ecr-refresher's Introduction

kube-ecr-refresher

A helper tool for refreshing Amazon ECR credentials in Kubernetes clusters periodically.

Motivation

Authorization tokens for Amazon ECR expire every 12h. This makes it cumbersome to pull images from Amazon ECR outside Amazon EKS, as image pull secrets must be refreshed (in each required namespace) with the same frequency to ensure uninterrupted access. kube-ecr-refresher takes care of automating this task by periodically creating/updating secrets containing fresh credentials in all namespaces (or just a subset of them) based on a given set of AWS credentials.

Prerequisites

  • A set of AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) having the AmazonEC2ContainerRegistryReadOnly policy attached to them.

Installing

To install kube-ecr-refresher, start by running

$ kubectl apply -f deploy/common.yaml
namespace/kube-ecr-refresher created
serviceaccount/kube-ecr-refresher created
clusterrole.rbac.authorization.k8s.io/kube-ecr-refresher created
clusterrolebinding.rbac.authorization.k8s.io/kube-ecr-refresher created

Then, edit deploy/secret.yaml in order to specify the aforementioned AWS credentials and run

$ kubectl apply -f deploy/secret.yaml
secret/kube-ecr-refresher created

Finally, run

$ kubectl apply -f deploy/deployment.yaml
deployment.apps/kube-ecr-refresher created

and make sure that kube-ecr-refresher is indeed running:

$ kubectl -n kube-ecr-refresher get pod -l app=kube-ecr-refresher
NAME                                  READY   STATUS    RESTARTS   AGE
kube-ecr-refresher-7dbcf68bc9-cn99c   1/1     Running   0          2s

Advanced

Customizing the target namespaces

By default, kube-ecr-refresher created/updates image pull secrets across all namespaces in the Kubernetes cluster. To create/update these secrets in just a subset of namespaces, add the --target-namespaces flag to the deployment and specify the desired namespaces as a comma-separated list.

Refreshing credentials for multiple Amazon ECR registries

By design, kube-ecr-refresher supports refreshing credentials for a single Amazon ECR registry (i.e. the one associated with the provided AWS credentials). If you need to pull images from multiple Amazon ECR registries in the same Kubernetes cluster, you must deploy an instance of kube-ecr-refresher per target Amazon ECR registry/set of AWS credentials.

License

Copyright 2019 Form3 Financial Cloud

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kube-ecr-refresher's People

Contributors

bmcustodio avatar emma-simmons-form3 avatar jeeves-form3 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.