Thursday, October 7, 2021

Installing python3 and pip3 on Centos7

Here I have no python3 installed

The most simplest way to install python3
sudo yum install python3

Make python 3.6 as default one
sudo alternatives --install /usr/bin/python python /usr/bin/python3.6 60
sudo alternatives --config python

Check the python version

Check the pip version

Check the pip3 version

Upgrade pip3
pip3 install --upgrade pip --user


Check the pip version


Bonus: Fixing yum package manager

Now lets try to install a random package to check the yum package manager

Install nano
sudo yum install nano
you will get following error

To fix this, Open the /usr/bin/yum file and in the first line, change python to python2


If again you got similar issue with different file, for example:

Open this file (sudo vi /usr/libexec/urlgrabber-ext-down ) and in the first line change "python" to "python2"


Here is the Youtube demo:



-That's all for now

Monday, September 20, 2021

Managing Kubernetes clusters using Rancher [20Sept2021]

Here is the Environment for me. You may go with single worker node 

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


Common installation

  1. 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": [

"default-address-pools": [{"base":"","size":24}]


  • Now run this command. It will add the official Docker repository, download the latest version of Docker, and install it:
curl -fsSL | sh
  • After installation has completed, start the Docker daemon:
sudo systemctl start docker
ERROR if docker is unable to start, try to check the /etc/docker/daemon.json file
  • Verify that it’s running:
sudo systemctl status docker
  • enable docker to start on boot:
sudo systemctl enable docker
  • To run docker commands with non-root privileges

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

Rancher node

  1. Enter the following command to run rancher container
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --privileged rancher/rancher
  1. Go to the web browser and hit https://<SERVER_IP_Rancher_Node>
  2. Follow the wizard for initial setup
Once it is done, you should be able to see the dashboard with local as the cluster name

Create a new cluster


  1. Go to the browser and access Rancher Dashboard
  2. From the dashboard, click on Create
  3. Click on Custom
  4. Give Cluster Name as cluster-1 and skipp other infos
  5. Click on Next
  6. Select etcd , Control Plane , Worker
  7. Select the Registration command
    1. The registration command should look like:
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.6.0 --server --token bflxwjlsvsrtbnvp8nj5xq82xx2sr5npjsxm82mbtdcfkc9g65x5d8 --ca-checksum f9bc8c23fff67155023fde69026ec83a77f632657f1049fd6ca9ae5732cf59d3 --etcd --controlplane --worker
  1. Go to master node terminal and execute the registration command

At this point you need to wait for few minutes...

  1. After this, you will see in the browser that 1 New node has registered.
  2. Now click on Done
  3. Repeat Step 6 to get the registration command for worker node. For worker node you just need to select Worker

Deleting a node

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/ \
	   /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 \

It is now good to reboot the VM with following command:

sudo reboot

-That's all

Saturday, April 3, 2021

Cloud Cost Comparison : 1vm/mo

 In this post, we will explore and compare the cost of hosting a small VM for 1 month in different clouds. 

1. Serverspace
Pricing Ref:
Configuration: Ubuntu 18.04, 1GB, 1core, 50Mbps, 25GB SSD
Cost/mo:         USD 4.55
Cost/hr:              USD 0.006

2. Kamatera Cloud
Configuration: Ubuntu 18.04, 1GB, 1core, 50Mbps, 20GB SSD
Cost/mo:         USD 4.00
Cost/hr:                 USD 0.005
Pricing Ref:

3. Linode
Configuration: 1GB, 1core, 25GB SSD, 1TB, 40GB NW In, 1000Mbps NW Out
Cost/mo:         USD 5.00
Cost/mo:         USD 0.0075
Pricing Ref:

4. ScalaHosting
Configuration: Ubuntu 20.04, 2GB, 1core, 50GB SSD, 3000GB bandwidth
Cost/mo:         USD 10.00
Cost/hr:                 USD 0.015
Pricing Ref:

5. Cloudways
Using there interface you only can create VMs in other cloud provideres, such as DigitalOcean, Linode, VULTR, AWS, Google Cloud
Pricing Ref:

6. LiquidWeb
Configuration: Linux, 2GB, 2 vCPU, 40GB SSD, 10TB bandwidth
Cost/mo:             USD 15 (if you go for 24months plan)
Other Addon:        InterWorx, Plesk Web Pro, or cPanel Admin

7. SiteGround
Configuration: 8GB, 4cores, 40GB SSD, 5TB data transfer
Cost/mo:         USD 80.00
Pricing Ref:

8. DigtialOcean
Configuration: 1GB, 1CPU, 25GB SSD, 1TB data transfer
Cost/mo:         USD 5.00
Cost/hr:                 USD 0.00744
Pricing Ref:

9. Vultr
Configuration: 512MB, 1CPU, 10GB SSD, 0.5TB data transfer
Cost/mo:         USD 3.5 (can be 2.5USD if you choose IPv6 version only )
Cost/hr:                 USD 0.005
Pricing Ref:

10. Amazon Web Services
Configuration: 1GB, 2vCPU, 10GB HDD, 0.5TB data transfer
Cost/mo:         USD 4.02 
Cost/hr:                 USD 0.005
Pricing Ref: