Rancher Kubernetes
This is my notes on Install Rancher Kubernetes on premise. Derive from several articles below.
Install Kubernetes Cluster By Rancher
ก่อนอื่นมารู้จักเจ้าตัว Rancher กันก่อนว่ามันคืออะไร?
medium.com
- Create Virtual Machine (3 VM)
- VM №1: Rancher Server
- VM №2: K8sMaster (Kubernetes etcd and controller)
- VM №3: K8sNode (Kubernetes worker node)
Make sure they can communicate to each other.
2. Install Rancher in VM №1: Rancher Server
sudo docker run -d --name=rancher --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
3. Create Cluster by access VM №1: Rancher Server
Add Cluster
Select Custom
Click Next
3.1 Create etcd and control plane. Select etcd and Control Plane. Copy Command and run it in VM №2 K8sMaster.
Run Copied Command in K8sMaster
3.2 Create worker node. Click Edit Cluster and scroll down the page. Select Worker. Copy Command and run it in VM №3 K8sNode.
Run Copied Command in K8sNode
If it’s hang on Registering for a long time, try checking your nginx-proxy logs. (If there is network problems in your logs. You might need to allow TCP port 6443 ufw on K8sMaster by following command)
sudo ufw allow 6443/tcp
If everything is good, you will see this.
4. Deploy workload as follow
If it’s done without error, you will see this.
You can try clicking on 30001/tcp. This will open the page in new browser. The link will be http://K8sNode:portNumber. Something like this. http://10.255.0.5:30001
If you can not access to that URL, I suggest you to use nginx reverse proxy to route it to the world and try it.