Using Minikube for local Kubernetes development is the easiest path to getting a cluster spun up. You just run a few commands and within minutes you've got yourself a kube cluster ready to go!

But what if you are looking at testing images you're going to use in a cloud environment. My company used AWS and we use ECR (Elastic Container Registry) as a private docker repository. If you try this, however, you'll be stuck because you do not have IAM credentials to pull from the registry.

You could manually login and pass those credentials to your minikube vm, but who wants to do that? I wrote a post on how to do this with a project I wrote called AWS ECR Creds, but it again required some manual steps to get running.

Now with a PR I sent to the minikube project, you can now just create a secret with the needed IAM credentials to access ECR and then enable the addon.

Steps to enable addon

Create Secret

Base64 encode your secrets and copy to sample secrets file. Do this for your AWS AccountId, AWS Secret and AWS Key.

echo -n "awsAccount" | base64  

Copy those into the secret file and apply to your cluster:

kubectl create -f secret.yaml  

Enable the addon:

minikube addons enable awsecr-creds  

Now deploy a pod to your cluster referencing the imaged pushed to ECR and it should automatically pull! By default the add-on will refresh the credentials every 11 hours and 55 minutes (the default expiry is 12 hours from AWS).