Azure Pipeline และ AWS EKS Workload

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 อีกด้วย

0*318jvhmnGzH-3gKB


ผมจะใช้ Amazon Elastic Container Registry (ECR) แทน Docker Hub นะคับ ใช้ Free Tier น่าจะ Free สำหรับ Private Repo 500 MB, Data Transfer Out ภายใน Region เดียวกัน Free

มาเริ่มกันเลยคับ:
  1. อันดับแรกสร้าง Organization ใน Azure DevOps กันก่อน:


  2. สร้าง Project
  3. ตัวอย่างนี้เราจะลองทำ Website Valentine กัน ก็ไป Import repository มา (https://github.com/goragodwiriya/valentine.git)
  4. สร้าง 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

  5. ทำ 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


  6. https://github.com/ThaiCPE/90DaysOfDevOps/blob/main/ci.yaml
:cool:
 
Last edited:
Top