Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #!/bin/bash
  2. rm /tmp/image-pull-secret.yaml
  3. login_cmd=$(aws ecr get-login)
  4. username=$(echo $login_cmd | cut -d " " -f 4)
  5. password=$(echo $login_cmd | cut -d " " -f 6)
  6. endpoint=$(echo $login_cmd | cut -d " " -f 9)
  7. auth=$(echo "$username:$password" | /usr/bin/base64)
  8.  
  9. configjson="{ \"auths\": { \"${endpoint}\": { \"auth\": \"${auth}\" } } }"
  10.  
  11. kubectl create -f - << EOF
  12. apiVersion: v1
  13. kind: Secret
  14. metadata:
  15. name: aws-ecr-registry
  16. data:
  17. .dockerconfigjson: $(echo $configjson | /usr/bin/base64)
  18. type: kubernetes.io/dockerconfigjson
  19. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement