Linux 101: Change hostname


During the deployment of a Kubernetes/K8s in 2 VMs on our lab environment (TrueNAS Scale), I realized that it will be definitely more comfortable to have appropriate host names for each VM. 

Therefore I will share with you these easy steps to amend/change the hostname of your linux host.


Now in order to check our current hostname we will type the following commands:

hostname
hostnamectl

As a next step we will proceed with the change of our hostname from .... to MASTER-NODE-KUBERNETES

sudo hostnamectl set-hostname MASTER-NODE-KUBERNETES

We proceed checking the hostname with this command:
hostnamectl



sudo nano /etc/hosts

Save it, reboot your machine and done. 


Comments

Leave as a comment:

Archive