บทนำ
บทความนี้อธิบายวิธีการสร้าง StatefulSet และ DaemonSet บน Sangfor SKE v2.2.0 ซึ่งเป็น workload types ที่แตกต่างจาก Deployment โดย StatefulSet ใช้สำหรับ stateful applications และ DaemonSet ใช้สำหรับ deploy Pod บนทุก node
ข้อกำหนดเบื้องต้น
- มี private image registry ที่ deploy ไว้แล้ว
- มี Kubernetes cluster และ namespace ที่พร้อมใช้งาน
ส่วนที่ 1: การสร้าง StatefulSet
Description: StatefulSet เป็น workload API object สำหรับจัดการ stateful applications โดยให้ guarantees เรื่อง ordering และ uniqueness ของ Pods แต่ละ Pod จะมี persistent identifier ที่คงอยู่ตลอดการ rescheduling
Applicable Scenario: เหมาะสำหรับ scenario ที่ต้องมีการ communicate ระหว่าง Pod เช่น etcd
1. เข้าสู่ระบบ SCP แล้วไปที่ Compute > Kubernetes Engine > Namespaces > Load Balancing > Workloads เลือก cluster และ namespace แล้วคลิก New
2. กรอกข้อมูลพื้นฐาน เลือก StatefulSet สำหรับ Type แล้วคลิก Next
3. ในขั้นตอน Pod settings ให้กำหนดค่าต่างๆ ดังรูป
4. (ไม่บังคับ) กำหนด network configuration แล้วคลิก Next
5. ยืนยัน configuration แล้วคลิก Finish
ส่วนที่ 2: การสร้าง DaemonSet
Description: DaemonSet ทำให้ทุก node (หรือบาง node) รัน copy ของ Pod เมื่อเพิ่ม node ใหม่เข้า cluster จะมี Pod ถูกเพิ่มโดยอัตโนมัติ เมื่อลบ node ออก Pod ก็จะถูกลบด้วย
Applicable Scenario: เหมาะสำหรับ scenario ที่ต้องรัน Pod บนทุก node เช่น Ceph
1. เข้าสู่ระบบ SCP แล้วไปที่ Compute > Kubernetes Engine > Namespaces > Load Balancing > Workloads เลือก cluster และ namespace แล้วคลิก New
2. กรอกข้อมูลพื้นฐาน เลือก DaemonSet สำหรับ Type แล้วคลิก Next
3. ในขั้นตอน Pod settings ให้กำหนดค่า Pod ดังรูป
4. (ไม่บังคับ) กำหนด network configuration แล้วคลิก Next
5. ยืนยัน configuration แล้วคลิก Finish
ข้อแตกต่างระหว่าง Deployment, StatefulSet และ DaemonSet
- Deployment: stateless resource object สำหรับ stateless applications ที่ instances สามารถสร้าง ลบ และแทนที่ได้อิสระ ใช้ ReplicaSet สำหรับ horizontal scaling และ rolling update
- StatefulSet: stateful resource object สำหรับ stateful applications ที่ instances ต้องมีชื่อและ network identifiers ที่เป็นลำดับและไม่ซ้ำกัน รับประกัน data consistency และ reliability
- DaemonSet: ใช้สำหรับ deploy Pod copy บนทุก node ใน cluster เหมาะสำหรับ monitoring agents, log collectors หรือ storage daemons
หมายเหตุ
- เลือก workload type ที่เหมาะสมกับลักษณะของ application: Deployment สำหรับ stateless, StatefulSet สำหรับ stateful, DaemonSet สำหรับ node-level services
บทความที่เกี่ยวข้อง
ข้อคิดเห็น
0 ข้อคิดเห็น
โปรด ลงชื่อเข้าใช้ เพื่อแสดงข้อคิดเห็น