Last active
June 6, 2022 13:23
-
-
Save lastcoolnameleft/a0421c6589a30264090279d7473d7ce6 to your computer and use it in GitHub Desktop.
Azure Container Registry to Minikube token passing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have az-cli installed, you can get the token with
az acr login --name $REG --expose-token --query accessToken -o tsv