การทำงานกับ AKS Clusters

Azure Compute Solutions

Florin Angelescu

Azure Cloud Architect

การสร้าง cluster

 

AKS

 

สร้าง cluster ผ่าน:

  • Azure Portal
  • Azure CLI
  • เครื่องมือ Infrastructure-as-code (ARM templates หรือ Bicep)
Azure Compute Solutions

การสร้าง cluster

 

AKS

 

  • กำหนดพารามิเตอร์:

    • จำนวน node
    • ขนาด VM
    • รูปแบบ networking
  • Azure จะตั้งค่า control plane ให้อัตโนมัติ

Azure Compute Solutions

การเชื่อมต่อด้วย kubectl

kubectl

  • ใช้ kubectl เพื่อโต้ตอบกับ cluster

    • เครื่องมือ command-line มาตรฐานของ Kubernetes
  • กำหนดค่า kubectl ให้เชื่อมต่อโดยดาวน์โหลด credentials ผ่าน Azure CLI

Azure Compute Solutions

การเชื่อมต่อด้วย kubectl

kubectl

  • รันคำสั่งเพื่อดู node ตรวจสอบ pod และ deploy แอปพลิเคชัน
  • workflow นี้เหมือนกับการทำงานกับ Kubernetes cluster ทั่วไป
Azure Compute Solutions

การ deploy แอปพลิเคชัน

 

Deployment

 

Kubernetes manifests

Azure Compute Solutions

การ deploy แอปพลิเคชัน

 

Deployment

 

Kubernetes manifests

  • ไฟล์ YAML
  • ระบุสถานะที่ต้องการของแอปพลิเคชัน
    • Container image
    • จำนวน replica
    • Networking
    • ทรัพยากรพื้นที่จัดเก็บข้อมูล
Azure Compute Solutions

การ deploy แอปพลิเคชัน

Deployment

  • ใช้ kubectl apply เพื่อนำ manifest ไปใช้งาน
  • Kubernetes จะทำให้สถานะจริงตรงกับสถานะที่กำหนดไว้
Azure Compute Solutions

การ deploy แอปพลิเคชัน

Deployment

  • กำหนด replica 3 ตัวสำหรับ web app
  • Kubernetes จะ schedule pod ทั้ง 3 ตัว
  • และรีสตาร์ทหากเกิดข้อผิดพลาด
Azure Compute Solutions

การ scale workload

Manual

Automatic

แบบ Manual

  • เพิ่มจำนวน replica
  • รองรับ traffic ที่เพิ่มขึ้น

แบบ Automatic

  • กำหนดค่า Horizontal Pod Autoscaler
  • ปรับจำนวน replica ตามการใช้งาน CPU หรือ memory
Azure Compute Solutions

การ scale workload

 

Autoscale

 

  • ระดับ Node:

    • AKS รองรับการ autoscale ของ cluster
    • เพิ่มหรือลด node ตามความต้องการ
  • แอปพลิเคชันยังคงตอบสนองได้ดีพร้อมควบคุมต้นทุน

Azure Compute Solutions

Networking

Networking

  • ผสานรวมกับ Azure Virtual Networks
  • Pod สามารถรับ IP address จาก VNet ได้
  • สื่อสารอย่างปลอดภัยกับทรัพยากร Azure อื่นหรืออินเทอร์เน็ต
Azure Compute Solutions

Storage

Networking

รองรับ persistent volumes:

  • Azure Disks
  • Azure Files
Azure Compute Solutions

การ monitor และแก้ไขปัญหา

 

 

Monitor

 

Azure Monitor and Log Analytics

  • ให้ข้อมูลเชิงลึกเกี่ยวกับ:

    • สุขภาพของ cluster
    • การใช้งานทรัพยากร
    • ประสิทธิภาพของแอปพลิเคชัน
  • ตั้งค่าการแจ้งเตือนเพื่อตรวจจับปัญหาแต่เนิ่น ๆ

  • ใช้ log เพื่อ debug ปัญหา
Azure Compute Solutions

สรุป

 

AKS

 

การทำงานกับ AKS clusters ประกอบด้วย:

  • การสร้าง cluster
  • การ deploy แอปพลิเคชัน
  • การ scale workload
  • การผสานรวม networking และ storage
  • การ monitor และแก้ไขปัญหา
Azure Compute Solutions

มาฝึกกันเถอะ!

Azure Compute Solutions

Preparing Video For Download...