Dự án

Tổng quan

Hồ sơ

Feature #145

Cập nhật bởi Tùng Nguyễn cách đây khoảng 1 năm

B1. Clone Template từ VMID 148 (K8s-UBUNTU) Proxmox-CMC-Q9 ở Pool TEMPLATE vào Pool LVS-K8s-SERVICE với tên VM longvan-node4 
 1 NIC: vmbr1 trunk all 
 16 core CPU 
 32G RAM 
 B2. Cấu hình thông tin hostname,IP, Password thông tin 
 ``` yaml 
 - hostname: longvan-node4 
 - Pass root: 86sx#VY2dEoP 
 - Disable SSH bằng user root 
 - Tạo user lv-nodes theo hướng dẫn 
 ``` yaml 
 sudo adduser lv-nodes --disabled-password 
 sudo usermod -aG sudo lv-nodes 

 === Chuyển qua user lv-nodes 
 sudo su - lv-nodes 
 mkdir .ssh 
 chmod 700 .ssh/ 
 cd .ssh/ 
 touch authorized_keys 
 chmod 600 authorized_keys 
 === Thêm public key của user lv-nodes vào file 
 nano authorized_keys 

 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOUz6yFm7HffFzc2kfQhKRysNJPkRC1OVo+wWYQYmvmziG1pWS6kBkQ6ICDtXlgs2uqNMIERvuRTfhO1+496MQpRNIF1XEMvGfpRw+DSejXpY6GCuAycrVFLfcKMIUdqvkascT15hyxvlOGlFW+kig4TY9e7bMWMGuXWEXKYYmjzYseNKuuofc5oaF5dbkAcnsp+XSuxd/jsf+72QFBs1rPeaXspHXbp4OyqEsLceU9FfvpWG+Zax8MmWMZIHuiiZA+qhLCXo2HOWvyve15YoMCgC9XsGPNVzZJy3o9k+8TmILz9mS63TgOM/pjyefP1qujwJVxbw5e5eBys1E5WFEvnk8Jah4DiWIrBf+abUKaOQRotBCmXPHIXFvOl1n+g18H1ZGQVIf99qLrmrWCsM1hZW53lVObJvFbtq7FrLIlohGd/5/jA+6zlnFCIa6Jvh8z4BuuPrnQXce25/5jhVP8OQBfC+en6a2/aVa66Qv1Sc/N+Ng8loXxdjA2OHHpLlR9AM0xoayAnmhPTNpC2O5u/z91NjxOHidfgo8ORDyE051y0FbeYLNZmvT6TZ8KQBFFyBek2lbf+F1renWT0xzmZ/fLDvr/aZdFvvttR7O4jWb5Cqbn4zCfH9xkpRIGm4bV/yfwgSGeEyIO4HmY1MPOPJr88Fr5KH8a4u+v7VtXw== lv-nodes@bastionhost 


 === Set quyền sudo cho user lv-nodes 
 sudo visudo 
 lv-nodes ALL=(ALL:ALL) NOPASSWD: ALL 
 ``` 

 https://projects.longvan.net/projects/longvan-devops/wiki/them-node-moi-vao-rke2-cluster 
 ``` 

 **Thông tin cấu hình network 

 ``` yaml 
 network: 
   ethernets: 
     ens18: 
       dhcp4: False 
   vlans: 
     ens18.620: 
       id: 620 
       link: ens18 
       addresses: [172.16.20.24/24] 
 #        gateway4: 172.16.20.1 
       routes: 
       - to: 10.6.9.0/24 
         via: 172.16.20.1 
       - to: 172.16.1.0/24 
         via: 172.16.20.1 
     ens18.18: 
       id: 18 
       link: ens18 
       addresses: [103.2.230.9/26] 
       gateway4: 103.2.230.1 
       nameservers: 
         addresses: 
         - 103.237.144.60 
         - 103.27.236.70 
     ens18.905: 
       id: 905 
       link: ens18 
       addresses: [10.6.22.204/24] 
   version: 2 
 ``` 


 B3. Kiểm tra ssh đến server bằng IP public và public key 
 B4. Đảm bảo ping OK đến domain rancher-cmchcm.longvan.vn 
 B5. Join K8s Cluster, từ trên node longvan-node4 chạy command sau 

 ``` yaml 
 curl -fL https://rancher-cmchcm.longvan.vn/system-agent-install.sh | sudo    sh -s - --server https://rancher-cmchcm.longvan.vn --label 'cattle.io/os=linux' --token 5r5769f526fmctc77whfxpk92x8jwctkqj4567tnqg25fq7mpkknwd --etcd --controlplane --worker 
 ``` 

 B6. Kiểm tra theo hướng dẫn node đã add cluster thành công chưa 
 Chạy các command sau với user root, hoặc thêm sudo với user khác 

 ``` yaml 
 export PATH=/var/lib/rancher/rke2/bin:$PATH 
 export KUBECONFIG=/etc/rancher/rke2/rke2.yaml 
 kubectl get nodes 
 ``` 

 ![](clipboard-202311061610-lrqvj.png) 

Quay lại