# Creating and deleting Kubernetes clusters

### Requirement

* network จะต้องเชื่อมต่อภายในของ Kubernetes master และ worker nodes
* SSH key ที่จะต้องติดตั้งให้กับ master และ worker nodes
* ต้องมี resources เพียงพอที่สามารถสร้าง Kubernetes nodes ได้ เช่น จำนวนของ volume, flavor เป็นต้น
* network ที่สร้างห้ามชนกันกับ default networks นี้:
  * 10.100.0.0/16 - ใช้สำหรับ network ของ pod-level
  * 10.254.0.0/16 - ใช้สำหรับ IP address ของ cluster

### วิธีสร้าง Kubernetes cluster

1. ไปที่หน้า **Kubernetes** **cluster** กด **Create**
2. ใส่ชื่อของ **cluster** เลือกเวอร์ชั่น และ **SSH key**
3. ในส่วนของ **Network**

   1. เลือก network ที่สามารถเชื่อมต่อเข้าถึงภายในของ kubernetes cluster
   2. เมื่อเลือก virtual network สามารถเลือกรูปแบบของการเข้าถึงได้ :
      * **None**: จะไม่สามารถเข้าถึง Kubernetes API ได้
      * **For Kubernetes API**: floating IP จะถูกเพิ่มให้กับ master node หรือ load balancer เมื่อ master node มีการทำ HA(high available)
      * **For Kubernetes API and nodes**: floating IP จะถูกเพิ่มให้กับ Kubernetes nodes ทั้งหมด (ทั้ง masters และ workers)
   3. เลือก **High Availability** สำหรับ master node หรือไม่เลือกก็ได้ ถ้าเปิดใช้งาน high availability - master nodes ทั้ง 3 nodes จะทำการสร้าง และเป็นโหมด Active/Active

   <figure><img src="/files/rGTJ0YYHSPXieGy07hxX" alt=""><figcaption></figcaption></figure>
4. ในส่วนของ **Master node** เลือก flavor สำหรับ master node
5. ตัวเลือกเพิ่มเติมในส่วนของการเปิดใช้งาน **Integrated monitoring** จะทำการ deploy อัตโนมัติ
6. ในส่วนของ **Container volume** เลือก storage policy ใส่ขนาดของ storage ที่ต้องการ ทั้ง master และ worker nodes
7. ในส่วนของ **Default worker group** เลือก flavor ให้แต่ละ worker ส่วนนี้สามารถเลือกให้มีการทำ automatic scaling ของ worker group ได้
   * **Autoscaling**: หากทำการเปิดใช้งาน worker จะถูกสร้างเพิ่มขึ้นอัตโนมัติเมื่อมี pods มีสถานะ pending, workers ไม่มี pods ทำงานอยู่
   * ถ้าปิด **Autoscaling** จำนวนของ worker node จะไม่ถูกสร้างเพิ่มขึ้น
8. ในส่วนของ **Labels** กำหนดตัวแปรเพิ่มเติม เช่น selinux\_mode=permissive
9. กด **Create**<br>

   <figure><img src="/files/p8BprnvtltB1uqlTrPaE" alt=""><figcaption></figcaption></figure>

### วิธีการลบ Kubernetes cluster

* กดเลือก **Kubernetes cluster** ที่ต้องการ และกด **Delete** ส่วนนี้ master และ worker vm จะถูกลบไปพร้อมกับ volume


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://readyidc.gitbook.io/readyidc-docs/readme/kubenetes-cluster/creating-and-deleting-kubernetes-clusters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
