Skip to content

Instantly share code, notes, and snippets.

@lastcoolnameleft
Last active June 6, 2022 13:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lastcoolnameleft/a0421c6589a30264090279d7473d7ce6 to your computer and use it in GitHub Desktop.
Save lastcoolnameleft/a0421c6589a30264090279d7473d7ce6 to your computer and use it in GitHub Desktop.
Azure Container Registry to Minikube token passing
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: acr-auth-example
spec:
template:
metadata:
labels:
app: acr-auth-example
spec:
containers:
- name: acr-auth-example
image: sandboxtmf.azurecr.io/helloacrtasks:v1
imagePullPolicy: Always
imagePullSecrets:
- name: acr-auth
REG=sandboxtmf
az acr login -n $REG
# Works only on OSX. Windows uses wincred, so someone would need to figure out the equivalent
TOKEN=`security find-internet-password -s $REG.azurecr.io -w`
USER=00000000-0000-0000-0000-000000000000
kubectl create secret docker-registry acr-auth --docker-server $REG.azurecr.io --docker-password=$TOKEN --docker-username=$USER
kubectl apply -f /tmp/deploy.yaml
@javiplx
Copy link

javiplx commented Jan 19, 2021

If you have az-cli installed, you can get the token with az acr login --name $REG --expose-token --query accessToken -o tsv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment