Created Tuesday 07 September 2021
Rancher node: Centos 7 (better to keep this separate from cluster nodes), flavor: m3.xsmall
Master Node: Centos 7, m3.xsmall
Worker Node-1: Centos 7, m3.xsmall
Worker Node-2: Centos 7, m3.xsmall
Both Master and Work Node have allow-all security group attached
Minimal ports required are 80/TCP, 443/TCP
[src: https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/
Common installation
- Install Docker
- Create the daemon file manually. This is also because of some conflict in University's Openstack Environment.
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<EOF { "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ],
"default-address-pools": [{"base":"172.80.0.0/16","size":24}]
} EOF
- Now run this command. It will add the official Docker repository, download the latest version of Docker, and install it:
- After installation has completed, start the Docker daemon:
- Verify that it’s running:
- enable docker to start on boot:
- To run docker commands with non-root privileges
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
Rancher node
- Enter the following command to run rancher container
- Go to the web browser and hit https://<SERVER_IP_Rancher_Node>
- Follow the wizard for initial setup
Create a new cluster
src: https://rancher.com/docs/rancher/v2.5/en/quick-start-guide/deployment/quickstart-manual-setup/
- Go to the browser and access Rancher Dashboard
- From the dashboard, click on Create
- Click on Custom
- Give Cluster Name as cluster-1 and skipp other infos
- Click on Next
- Select etcd , Control Plane , Worker
- Select the Registration command
- The registration command should look like:
- Go to master node terminal and execute the registration command
- After this, you will see in the browser that 1 New node has registered.
- Now click on Done
- Repeat Step 6 to get the registration command for worker node. For worker node you just need to select Worker
Deleting a node
[src: https://rancher.com/docs/rancher/v2.5/en/cluster-admin/cleaning-cluster-nodes/]
Deleting Docker Containers, Images, and Volumes
Based on what role you assigned to the node, there are Kubernetes components in containers, containers belonging to overlay networking, DNS, ingress controller and Rancher agent. (and pods you created that have been scheduled to this node)
To clean all Docker containers, images and volumes:
docker rm -f $(docker ps -qa) docker rmi -f $(docker images -q) docker volume rm $(docker volume ls -q)
Clean the related directories
sudo rm -rf /etc/ceph \ /etc/cni \ /etc/kubernetes \ /opt/cni \ /opt/rke \ /run/secrets/kubernetes.io \ /run/calico \ /run/flannel \ /var/lib/calico \ /var/lib/etcd \ /var/lib/cni \ /var/lib/kubelet \ /var/lib/rancher/rke/log \ /var/log/containers \ /var/log/kube-audit \ /var/log/pods \ /var/run/calico
It is now good to reboot the VM with following command:
-That's all