Change a Linux Device Hostname (and make it stick)

Temporary change

sudo hostnamectl set-hostname my-node-01

Permanent files

Edit two files:

sudo nano /etc/hostname
# replace the name

sudo nano /etc/hosts
127.0.1.1 my-node-01

Apply and verify

sudo systemctl restart systemd-hostnamed
hostname

Conclusion

A unique hostname avoids conflicts in Kubernetes and SSH. Always reboot or restart services to apply it fully.