k3s هو توزيعة Kubernetes معتمدة من CNCF تستهلك 60 MB، تعمل على Raspberry Pi، وهي الخيار عندما تحتاج Kubernetes بدون عبء التشغيل.
المتطلبات المسبقة
- مضيف Linux (Ubuntu 22.04 / Debian 12 / Rocky 9).
- 1 vCPU، 1 GiB ذاكرة لكل عقدة.
الخطوة 1: تثبيت عقدة التحكم
curl -sfL https://get.k3s.io | sh -
sudo k3s kubectl get nodes
sudo k3s kubectl get pods -A
الخطوة 2: استخدام kubeconfig كمستخدم عادي
mkdir -p ~/.kube
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
chmod 600 ~/.kube/config
kubectl get nodes
الخطوة 3: إضافة عقد عاملة
على عقدة التحكم:
sudo cat /var/lib/rancher/k3s/server/node-token
على كل عامل:
curl -sfL https://get.k3s.io | K3S_URL=https://control-plane.example.sa:6443 \
K3S_TOKEN=<token> sh -
الخطوة 4: ما يثبته k3s افتراضيًا
- coredns
- local-path-provisioner
- metrics-server
- traefik (ingress)
- svclb-traefik (LoadBalancer)
الخطوة 5: اختبار حمولة عمل
kubectl create deployment hello --image=nginxdemos/hello:latest
kubectl expose deployment hello --port=80 --type=NodePort
kubectl get svc hello
curl http://control-plane.example.sa:31234/
الخطوة 6: التحديث/الإزالة
curl -sfL https://get.k3s.io | sh -
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.30.2+k3s1 sh -
/usr/local/bin/k3s-uninstall.sh
/usr/local/bin/k3s-agent-uninstall.sh
التحقق
kubectl get nodes -o wide
kubectl get pods -A
sudo systemctl status k3s --no-pager
الخاتمة
k3s = Kubernetes حقيقي عبر curl واحد.
Comments
0 total · 0 threads