PlAwAnSaI
Administrator
Code:
https://medium.com/@abdulfayis/azure-pipelines-and-aws-workloads-02b1b979c22e
Thread นี้ให้คำแนะนำเกี่ยวกับการ Deploy Private Workload บน Amazon EKS โดยใช้ Azure Pipeline การรวมกันระหว่าง Azure Pipeline และ AWS ช่วยให้สามารถ Deploy และจัดการ Kubernetes App ได้อย่างราบรื่นใน Private Environment ของ AWS
วัตถุประสงค์ของการใช้ Azure Pipeline สำหรับ Workload บน AWS คือการใช้ประโยชน์จาก Platform CI/CD ที่ทรงพลังและยืดหยุ่น ซึ่งรองรับการทำงานข้ามผู้ให้บริการ Cloud หลายราย ช่วยเพิ่มประสิทธิภาพในกระบวนการพัฒนาและ Deploy App ที่ทำงานบน AWS วิธีการนี้สอดคล้องกับหลักการของ DevOps ที่เน้นความร่วมมือ การทำงานอัตโนมัติ และการส่งมอบ Software อย่างรวดเร็ว
Thread นี้เป็นคู่มือแบบย่อสำหรับการนำ Azure Pipeline และการผสานรวมกับ AWS มาใช้งาน โดยมุ่งเน้นที่ Best Practice ด้าน CI/CD, คุณภาพของ Code และการ Deploy App บน Elastic Kubernetes Service (EKS)
ด้วยการผสานรวม Azure Pipeline กับ AWS EKS อย่างไร้รอยต่อ Solution นี้ช่วยให้งาน CI/CD เป็นไปโดยอัตโนมัติสำหรับการ Deploy ที่มีประสิทธิภาพและคุณภาพสูง นอกจากนี้ยังส่งเสริมความร่วมมือและเพิ่มประสิทธิภาพในการ Deploy บน EKS อีกด้วย
ผมจะใช้ Amazon Elastic Container Registry (ECR) แทน Docker Hub นะคับ ใช้ Free Tier น่าจะ Free สำหรับ Private Repo 500 MB, Data Transfer Out ภายใน Region เดียวกัน Free
มาเริ่มกันเลยคับ:
- อันดับแรกสร้าง Organization ใน Azure DevOps กันก่อน:
- สร้าง Project
- ตัวอย่างนี้เราจะลองทำ Website Valentine กัน ก็ไป Import repository มา (https://github.com/goragodwiriya/valentine.git)
- สร้าง Dockerfile (Azure DevOps จะทำ Version Control ให้เราโดยอัตโนมัติทุก File)
Code:# ใช้ Nginx เป็น Base Image FROM nginx:latest # คัดลอก File HTML และ Folder ทั้งหมดไปยังตำแหน่งที่ Nginx ใช้เก็บ File COPY ./ /usr/share/nginx/html/ # เปิด Port 80 สำหรับให้บริการ Web EXPOSE 80
- ทำ Pipeline CI Push ไป AWS ECR
Code:{ "Version": "2012-10-17", "Statement": [ { "Sid": "ListImagesInRepository", "Effect": "Allow", "Action": [ "ecr:ListImages" ], "Resource": "arn:aws:ecr:ap-southeast-7:381491935:repository/valentine" }, { "Sid": "GetAuthorizationToken", "Effect": "Allow", "Action": [ "ecr:GetAuthorizationToken" ], "Resource": "*" }, { "Sid": "ManageRepositoryContents", "Effect": "Allow", "Action": [ "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage", "ecr:CompleteLayerUpload", "ecr:DescribeImages", "ecr:DescribeRepositories", "ecr:UploadLayerPart", "ecr:ListImages", "ecr:InitiateLayerUpload", "ecr:BatchCheckLayerAvailability", "ecr:GetRepositoryPolicy", "ecr:PutImage" ], "Resource": "arn:aws:ecr:ap-southeast-7:381491935:repository/valentine" } ] }
Code:https://docs.aws.amazon.com/AmazonECR/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-access-one-bucket
- https://github.com/ThaiCPE/90DaysOfDevOps/blob/main/ci.yaml
Last edited: