Codepipeline

์ด์ œ AWS CloudFormation์„ ์‚ฌ์šฉํ•˜์—ฌ AWS CodePipeline์„ ์ƒ์„ฑํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด ํŒŒ์ดํ”„๋ผ์ธ์€ GitHub Source repo(eks-example)์—์„œ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๊ตฌ์ถ•ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•ด๋„ ์ด๋ฏธ์ง€๊ฐ€ ๋ฐฐํฌ๋˜์ง€ ์•Š์œผ๋ฉฐ Weave Flux ์—์„œ ์ด๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

CloudFormation์€ ํด๋ผ์šฐ๋“œ ํ™˜๊ฒฝ์˜ ๋ชจ๋“  ์ธํ”„๋ผ ๋ฆฌ์†Œ์Šค๋ฅผ ์„ค๋ช…ํ•˜๊ณ  ํ”„๋กœ๋น„์ €๋‹ํ•  ์ˆ˜ ์žˆ๋Š” ๊ณตํ†ต ์–ธ์–ด๋ฅผ ์ œ๊ณตํ•˜๋Š” IaC(infrastructure as code) ํˆด์ž…๋‹ˆ๋‹ค. CloudFormation์„ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ„๋‹จํ•œ ํ…์ŠคํŠธ ํŒŒ์ผ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋“  region๊ณผ account์— ๊ฑธ์ณ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ํ•„์š”ํ•œ ๋ชจ๋“  ๋ฆฌ์†Œ์Šค๋ฅผ ์ž๋™ํ™”๋˜๊ณ  ์•ˆ์ „ํ•˜๊ฒŒ ๋ชจ๋ธ๋งํ•˜๊ณ  ํ”„๋กœ๋น„์ €๋‹ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฐ EKS ๋ฐฐํฌ/์„œ๋น„์Šค๋Š” ์ž์ฒด CodePipeline์ด ์žˆ์–ด์•ผ ํ•˜๋ฉฐ ๋ถ„๋ฆฌ๋œ ์†Œ์Šค ์ €์žฅ์†Œ์— ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์•„๋ž˜ ํŒŒ์ผ์„ ํด๋ฆญํ•˜์—ฌ ๋‹ค์šด ๋กœ๋“œ ํ›„ AWS Management Console์— CloudFormation ์Šคํƒ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

  • ์Šคํƒ ์ด๋ฆ„ : image-codepipeline

  • Username : git username

  • Access token : git access key

  • Repository : eks-example

  • Branch : main

Stack์ด ์™„๋ฃŒ(CREATE_COMPLETE)๋ ๋•Œ ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค.

CodePipeline in the Management Console ์— ์ ‘์†ํ•˜์—ฌ image-codepipeline ์œผ๋กœ codepipeline์ด ์‹œ์ž‘๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ˜„์žฌ ์ €์žฅ์†Œ์— ์ฝ”๋“œ๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ด๋ฏธ์ง€ ๋นŒ๋“œ์— ์‹คํŒจ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

GitHub repo์— ์ƒ˜ํ”Œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ถ”๊ฐ€ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์•„๋ž˜ ${YOURUSER}๋ฅผ GitHub ์‚ฌ์šฉ์ž ์ด๋ฆ„์„ ๋Œ€์ฒดํ•ฉ๋‹ˆ๋‹ค.

git clone git@github.com:${YOURUSER}/eks-example.git
cd eks-example

๊ทธ๋Ÿฐ ๋‹ค์Œ ๊ธฐ๋ณธ README ํŒŒ์ผ, ์›๋ณธ ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ๋งŒ๋“ค๊ณ  ์ƒ˜ํ”Œ nginx ๊ตฌ์„ฑ(hello.conf), ํ™ˆ ํŽ˜์ด์ง€(index.html) ๋ฐ ๋„์ปค ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

echo "# eks-example" > README.md
mkdir src
wget -O src/hello.conf https://raw.githubusercontent.com/aws-samples/eks-workshop/main/content/intermediate/260_weave_flux/app.files/hello.conf
wget -O src/index.html https://raw.githubusercontent.com/aws-samples/eks-workshop/main/content/intermediate/260_weave_flux/app.files/index.html
wget https://raw.githubusercontent.com/aws-samples/eks-workshop/main/content/intermediate/260_weave_flux/app.files/Dockerfile

์ด์ œ ๊ฐ„๋‹จํ•œ hello world app๋ฅผ commitํ•˜์—ฌ codepipeline ์„ ์‹œ์ž‘์‹œํ‚ต๋‹ˆ๋‹ค.

git add .
git commit -am "Initial commit"
git push 

๋นŒ๋“œ ์ด๋ฏธ์ง€๋ฅผ ํ™•์ธํ•˜์—ฌ ์œ„ํ•˜์—ฌ Amazon ECR console ์ ‘์†ํ•˜์—ฌ eks-example image repository๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

Last updated

Was this helpful?