How to add host mapping to /etc/host of the minikube?

by margarett , in category: General Help , 7 months ago

How to add host mapping to /etc/host of the minikube?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers


by lonzo , 7 months ago


To add a host mapping to the "/etc/hosts" file of Minikube, you can follow these steps:

  1. Start the Minikube cluster: minikube start
  2. Open a terminal session to the Minikube VM: minikube ssh
  3. Switch to the root user to have the necessary permissions: sudo -i
  4. Edit the "/etc/hosts" file using a text editor like vi or nano: vi /etc/hosts
  5. Add the host mapping to the file. For example, to map "" to an IP address of "", add the following line:
  6. Save and exit the file.
  7. Verify that the host mapping has been added correctly: cat /etc/hosts The output should include the line you added.
  8. Exit the root user and Minikube VM: exit exit

That's it! The host mapping should now be available in Minikube.

by damian_mills , 2 months ago


Keep in mind that modifying the "/etc/hosts" file directly in Minikube is a manual process and may not be a recommended practice depending on the use case. In a production environment, it's better to manage host mappings through Kubernetes resources like Services, Ingress, or DNS configurations.