ติดตั้ง Kubernetes (K3s) และ Rancher บน Ubuntu Server
วิธีติดตั้ง Kubernetes (K3s) และ Rancher บน Ubuntu Server:
1. ติดตั้ง Docker:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
2. ติดตั้ง Kubernetes (K3s) แบบ Lightweight:
curl -sfL https://get.k3s.io | sh -
ตรวจสอบสถานะของ K3s:
sudo kubectl get nodes
3. ติดตั้ง Rancher ด้วย Helm:
- ติดตั้ง Helm:
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- เพิ่ม Rancher Helm repo:
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
- สร้าง namespace สำหรับ Rancher:
kubectl create namespace cattle-system
- ติดตั้ง Rancher ด้วย Helm:
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=<your-rancher-server>
4. เปิดใช้งาน Rancher UI:
- เข้าถึง Rancher ผ่านเบราว์เซอร์โดยใช้
https://<your-rancher-server>
เท่านี้ก็สามารถเริ่มใช้งาน Rancher เพื่อจัดการ Kubernetes ได้แล้ว