# Create RKE2 Cluster via Rancher Dashboard

## Prerequisite

1. Rancher Server ที่พร้อมใช้งานแล้ว หากคุณยังไม่มีสามารถดูวิธีการสร้าง [ได้ที่นี่](/ncs-documents/tutorial/install-rancher-server-with-docker-quick-start.md)
2. Instance ทั้งหมดใช้ Image "Ubuntu 22.04"

<figure><img src="/files/0QQ7CIhCEeqH9a4Vm7wJ" alt=""><figcaption></figcaption></figure>

2. Instance สำหรับ Control Plane, etcd จำนวน 1 เครื่อง
3. Instance สำหรับ Worker จำนวน 1 เครื่อง
4. Control Plane, etcd และ Worker นั้นจะต้องทำงานอยู่บน VPC Network เดียวกัน
5. Control Plane, etcd และ Worker นั้นจะต้องมี Security Group ที่ชื่อว่า "In-Cluster" จากการสร้าง Project และ "Auto-Create Settings" มีการเลือกเครื่องหมายถูกที่ Default Security Group หรือ Security Group อื่นที่มี Rule ดังภาพประกอบด้านล่างนี้ เพื่อให้ Instance ทั้งหมดใน Cluster สามารถสื่อสารถึงกันระหว่างกันได้

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

<div align="center"><figure><img src="/files/wJdCOHLjGJCrsXnyq3uy" alt=""><figcaption></figcaption></figure></div>

> ระหว่างการสร้าง Project ให้เลือกเครื่องหมายถูกที่ "Default Security Group" เพื่อให้ระบบสร้าง Security Group ที่ชื่อว่า "In-Cluster" มาโดยเริ่มต้น

## Instructions

1. ให้คุณเลือกแถบ Cluster Management ที่ด้านซ้ายของ Rancher Dashboard

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

2. หลังจากนั้นให้เลือก Create ที่ด้านขวาบน เพื่อสร้าง Cluster

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

3. ปรับ Switch ไปทาง "RKE2/K3s"

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

4. เลือก Custom เพื่อสร้าง Cluster จาก Instance ที่กำลังทำงานอยู่บน Nipa Cloud Space

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

5. ระบุ Cluster Name ตามที่คุณต้องการที่ด้านบน สำหรับส่วน Configuration อื่นๆ นั้นให้ละเว้นเป็นค่าเริ่มต้นทั้งหมด

<figure><img src="/files/09BuKzalLwrWbitrbeR2" alt=""><figcaption></figcaption></figure>

6. เลือก Create ที่ด้านขวาล่าง

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

7. หลังจากเลือก Create แล้ว ถัดไปที่ Step 1 ให้เลือกเครื่องหมายถูกที่ช่อง "etcd" และ "Control Plane" ต่อไปที่ Step 2 ให้เลือกเครื่องหมายถูกที่ Insecure ที่ด้านล่างคำสั่งที่ปรากฏ และคุณจะต้องนำคำสั่งเหล่านี้ไปวางที่ Terminal ของ Instance ที่กำลังทำงานอยู่ เพื่อให้ Instance นั้นทำหน้าที่เป็น Master Node สำหรับ Kubernetes Cluster

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

8. เมื่อได้ Control Plane และ Worker แล้วให้ทำเหมือนขั้นตอนที่แล้วอีกรอบ แต่เลือกเครื่องหมายถูกที่ Worker เพียงช่องเดียว และนำคำสั่งที่ปรากฏไปวางที่ Terminal ของ Instance เช่นเดียวกัน

<figure><img src="/files/5U6LPxEnN7ALJxuDJ1Al" alt=""><figcaption></figcaption></figure>

9. ตรวจสอบที่แถบ Machines จะพบ Node ที่ถูกเพิ่มเข้ามาจาก Instance ที่กำลังทำงานอยู่บน Nipa Cloud Space โดยขั้นตอนนี้อาจจะต้องใช้เวลาสักพักหนึ่งเพื่อให้ Kubernetes Cluster เข้าสู่สถานะ Active

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

10. หลังจากรอเป็นระยะเวลาหนึ่งจะพบว่า Kubernetes Cluster ที่ได้สร้างจากขั้นตอนก่อนหน้านั้น เข้าสู่สถานะ Active และพร้อมที่จะใช้งาน

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

11. เมื่อได้ Cluster ที่พร้อมใช้งานแล้ว ให้กด "Explore" ที่ด้านบน

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

12. ที่ด้านขวาบนจะมี Icon ดังรูปด้านล่าง ให้กดที่ Icon นั้นเพื่อ Download KubeConfig และจะนำไปใช้ที่ [Open Lens](https://k8slens.dev/) ต่อไป

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

13. ขวาบนของ Open Lens นั้นให้เลือก File ➝ Add Cluster ดังรูป

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

14. นำ Content ของไฟล์ KubeConfig ที่ Download มาก่อนหน้านั้นมาวางในช่องด่านล่าง และกด "Add Clusters" ที่ปุ่มด้านล่างของช่อง

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

15. คุณสามารถเข้าถึง Cluster ที่เพิ่มมาจากขั้นตอนก่อนหน้าได้ที่ Catalog ➝ Clusters ดังรูป

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

16. กดที่รายการ Cluster เพื่อเชื่อมต่อไปยัง Cluster นั้นๆที่คุณต้องการ

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

17. เมื่อเชื่อมต่อไปยัง Cluster แล้วจะปรากฎหน้าลักษณะนี้เป็นการเข้าถึง Cluster สำเร็จ

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


---

# 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://docs-epc.gitbook.io/ncs-documents/tutorial/install-rancher-server-with-docker-quick-start/create-rke2-cluster-via-rancher-dashboard.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.
