บทความนี้อธิบายวิธีการจัดการ Persistent Volume (PV), StorageClass (SC) และ Persistent Volume Claim (PVC) บน Sangfor Kubernetes Engine (SKE) v2.2.0 ซึ่งเป็นระบบ storage ที่ช่วยให้ container สามารถเก็บข้อมูลได้อย่างถาวร
ข้อมูลทั่วไปเกี่ยวกับ Storage บน SKE
SKE รองรับระบบ storage 3 ประเภทหลัก:
- Persistent Volume (PV): abstract storage resource ที่กำหนด storage เป็น resource สำหรับ container ใช้งาน รองรับ virtual datastores, EDS และ NFS
- StorageClass (SC): abstract definition ของ storage resource ที่ช่วยให้ระบบสร้าง PV โดยอัตโนมัติ (dynamic provisioning)
- Persistent Volume Claim (PVC): request สำหรับ storage จาก Pod โดยกำหนดขนาดและ access mode
การสร้าง Persistent Volume (PV)
เงื่อนไขเบื้องต้น: Kubernetes user cluster ถูก deploy แล้ว
ขั้นตอน:
1. เข้าสู่ระบบ SCP ไปที่ Resources > Compute > Kubernetes Engine > Cluster Management > Persistent Volumes คลิก New
การสร้าง StorageClass (SC)
เงื่อนไขเบื้องต้น: ต้องมีอย่างน้อยหนึ่งในเงื่อนไขต่อไปนี้:
- EDS storage pool ถูกสร้างบน SCP และ block storage service ถูก activate
- EDS storage pool ถูกสร้างบน SCP และ NFS ถูก activate
- NFS server พร้อมใช้งาน
ขั้นตอน:
1. ไปที่ Cluster Management > Storage > Storage Classes คลิก New
2. สำหรับ aSAN: เลือก aSAN สำหรับ CSI กรอกข้อมูลที่จำเป็น คลิก OK
3. สำหรับ EDS NAS: เลือก EDS NAS สำหรับ CSI กรอกชื่อ เลือก file storage pool คลิก OK
4. สำหรับ Standard NFS: ตั้ง Storage Type เป็น Standard NFS กรอก StorageClass name, server path, mount path และ protocol version คลิก OK
การสร้าง PVC (Adding a PVC)
คำอธิบาย: เมื่อสร้าง Pod ผ่าน workload หรือ Job/CronJob และกำหนด PV ให้ Pod จะมีการสร้าง PVC โดยอัตโนมัติ หรือสามารถสร้างเองได้
ขั้นตอน:
1. ไปที่ Namespaces > Persistent Volume Claims คลิก New
2. กรอกข้อมูล ได้แก่ ชื่อ, alias (optional), provisioning mode (Dynamic เป็นค่าเริ่มต้น), เลือก SC และกำหนดขนาด storage จากนั้นคลิก OK
การแก้ไข PVC (Editing a PVC)
ขั้นตอน:
ไปที่ Namespaces > Persistent Volume Claims ค้นหา PVC ที่ต้องการ คลิก Edit สามารถปรับขนาด storage ที่ request ได้
การลบ PVC (Deleting a PVC)
ขั้นตอน:
ไปที่ Namespaces > Persistent Volume Claims ค้นหา PVC ที่ต้องการ คลิก Delete
หมายเหตุสำคัญ
- PVC รองรับ access mode หลายแบบ: ReadWriteOnce, ReadOnlyMany, ReadWriteMany และ ReadWriteOncePod
- StorageClass ช่วยให้ระบบสร้าง PV อัตโนมัติ (dynamic provisioning) ลดภาระการจัดการ PV ด้วยตนเอง
- การลบ PVC ที่ยังถูกใช้งานอยู่โดย Pod จะทำให้ Pod ไม่สามารถเข้าถึง storage ได้
อ้างอิงจากคู่มือผู้ใช้ Sangfor SKE v2.2.0 - Storage Management
ข้อคิดเห็น
0 ข้อคิดเห็น
โปรด ลงชื่อเข้าใช้ เพื่อแสดงข้อคิดเห็น