Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amazon ECRをAWSの外から使う / Docker Meetup Kansai #5 ...

sasaki
November 22, 2019

Amazon ECRをAWSの外から使う / Docker Meetup Kansai #5 AmazonECR

sasaki

November 22, 2019
Tweet

More Decks by sasaki

Other Decks in Technology

Transcript

  1. &$3ྉۚ w ετϨʔδ w 64%(# w σʔλసૹ *O  w

    ແྉ w σʔλసૹ 0VU  w ˠ w ಉҰϦʔδϣϯ಺ͷ&$ͱͷσʔλసૹ͸ແྉ ౦ژϦʔδϣϯɺݱࡏ https://aws.amazon.com/jp/ecr/pricing/
  2. "84αʔϏε͔Βͷ1VMM ΫϩεΞΧ΢ϯτ ECR AWS Account A docker pull (Image) Download

    EKS ECS IAM Role IAM Role ECR͔ΒͷPull͕ڐՄ͞ΕͨϙϦγʔ AWS Account B ผΞΧ΢ϯτΛڐՄ͢ΔϙϦγʔ
  3. "84֎͔Βͷ&$3Πϝʔδͷ1VMM ECR AWS Account GetAuthorizationToken (aws ecr get-login) Token docker

    login -u AWS -p (Token) (ECR URL) Login Succeeded docker pull (Image) Download ECR͔ΒͷPull͕ڐՄ͞ΕͨϙϦγʔ
  4. https://medium.com/@damitj07/how-to-configure-and-use-aws-ecr-with-kubernetes-rancher2-0-6144c626d42c - /bin/sh - -c - |- ACCOUNT=1234567890 REGION=my-region-1 SECRET_NAME=${REGION}-ecr-registry

    [email protected] TOKEN=`aws ecr get-login --region ${REGION} --registry-ids ${ACCOUNT} | cut -d' ' -f6` kubectl delete secret --ignore-not-found $SECRET_NAME kubectl create secret docker-registry $SECRET_NAME \ --docker-server=https://${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com \ --docker-username=AWS \ --docker-password="${TOKEN}" \ --docker-email="${EMAIL}" echo "Secret created by name. $SECRET_NAME" kubectl patch serviceaccount default -p '{"imagePullSecrets":[{"name":"'$SECRET_NAME'"}]}'