This is my documentation for how to in my POC project for Kubernetes deployment using rancher in one of my customer private cloud based on Cloudstack. I assume you have understood the usage, if not please go and check the documentation first to get the how to here
Environtment;
1. 3 Master node for Rancherd control plane and kubernetes etcd masters
2. 3 worker nodes for kubernetes with deployement rancherd agent
3. Cloudstack loadbalancer for Rancher and rancherd HA and exposing HTTP/HTTPS port from kubernetes deployment
IP address allocation
- 10.1.1.44 for 1st rancher node
- 10.1.1.42 for 2nd rancher node
- a public IP address of a domain
OS/VM Configuration
– Ubuntu 20.04
– ufw disabled
#systemctl stop ufw && systemctl disable ufw
– Disable memory swappines
#vi /etc/sysctl.conf ....Add this line at the end.... vm.swappiness=10 ...Save and Exit... #sysctl -p
RancherD Instalation On 1st master
- Download and install rancherD for Master Nodes
#curl -sfL https://get.rancher.io | sh - #systemctl enable rancherd-server.service #systemctl start rancherd-server.service
Get token and save it from /var/lib/rancher/rke2/server/node-token. It will be use in the 2nd/3rd master rancherD-agent.
- Create config /etc/rancher/rke2/config.yaml with rancher url, hostname and ip address of masters
#vi /etc/rancher/rke2/config.yaml
token: K10b1ffb4084c7a8c75a12062362e5ada0376dec730f54eb3b6d96e83f70b420b34::server:cab9a8cd71bd853b0e80028c64bbffba
tls-san:
- https://rancher.asrarabukhair.com
- 10.1.1.44
- 10.1.1.224
- public-ip-of-domain
- Restart Rancher
- Configure the kubectl and kubeconfig
//Check all componen deployed in logs by setting up kubectl location/path and config location
#export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
#PATH=$PATH:/var/lib/rancher/rke2/bin
//Check deployment status
#kubectl get daemonset rancher -n cattle-system
#kubectl get pod -n cattle-system
Install Rancher on 2nd and N masters
- Download and install RancherD
#curl -sfL https://get.rancher.io | sh -
- Create config for rke2 to connect each other with the token from 1st master
#vi /etc/rancher/rke2/config.yaml server: https://rancher.asrarabukhair.com:9345 token: K10b1ffb4084c7a8c75a12062362e5ada0376dec730f54eb3b6d96e83f70b420b34::server:cab9a8cd71bd853b0e80028c64bbffba
- Enable and start rancherD-agent
#systemctl enable rancherd-agent.service #systemctl start rancherd-sagent.service
- Check the log on each node to make sure all connected
Configure TCP load balancer
- Configure Load balancer for Rancher UI port 8443 to master1-N
- Configure Load balancer for kubeapi port 6443 to master1-N
- Configure Load balancer for rancherd port 9345 to master1-N
Then enjoy your Kubernetes deployment using rancherD
