Renaming AWS EC2 Hostnames (Optional)
The default hostnames created by AWS are not intuitive for the MemVerge.ai cluster. You can rename your AWS EC2 instances to more intuitive hostnames like mvai-mgmt
and mvai-nvgpu01
. This will make your cluster management more manageable.
Note: It is recommended that at least the Management
- Update the hostname on each instance
SSH into each EC2 instance and run the following commands:
Replace "new-hostname" with your desired hostname (e.g., MemVerge.ai-mgmt, MemVerge.ai-node001).
- Update /etc/hosts file
Edit the /etc/hosts file and add a line with the new hostname below the default 127.0.0.1 localhost
line:
- Update DNS settings (Optional)
If you're using Amazon Route 53 or another DNS service, update the DNS records to reflect the new hostnames.
- Reboot the host:
- When the system boots, verify the new hostname is correct:
Updating /etc/hosts on All Nodes
To ensure proper communication between nodes in your cluster, you must add the hostnames and IP addresses of all nodes to the /etc/hosts
file on each system. This step is crucial when not using DNS for hostname resolution. If you use DNS, this step is not required. Ensure your DNS entries are correct.
Follow these steps:
-
Gather the private IP addresses and hostnames of all nodes in your cluster using
ip a
. -
SSH into each node (management and worker nodes). The default user for Ubuntu Linux is
ubuntu
:
- On each node, edit the /etc/hosts file:
- Add entries for all nodes in your cluster. The format is:
For example, add these lines:
Add an entry for each node in your cluster, including the node you're currently editing.
-
Save the file and exit the editor (in nano, press Ctrl+X, then Y, then Enter).
-
Repeat steps 2-5 for each node in your cluster.
-
Verify the changes by pinging other nodes using their hostnames:
Ensure that each node can ping all other nodes using their hostnames.
By adding these entries to /etc/hosts
on all systems, you ensure that each node can resolve the hostnames of other nodes in the cluster. This is crucial for Kubernetes and other cluster components to communicate properly.
Remember to update the /etc/hosts
file on all nodes whenever you add or remove nodes from your cluster. While this manual process works well for smaller, static clusters, using DNS is generally preferred for larger or more dynamic environments.