Sample Header Ad - 728x90

Problems updating /etc/hosts file via command bash -c

0 votes
1 answer
64 views
Trying to update host configuration file via command : $ sudo bash -c 'echo $(minikube ip) blue.io green.io >> /etc/hosts' Command was passed, but host configuration file /etc/hosts was not updated. If after command above, I pass the following command: $ sudo bash -c 'echo $(minikube ip) blue.io green.io | cat' The following message is returned: "Profile "minikube" not found. Run "minikube profile list" to view all profiles. 👉 To start a cluster, run: "minikube start" blue.io green.io. If I run command below: $ sudo nano /etc/hots I can see two times the following message at the bottom of the script: "Profile "minikube" not found. Run "minikube profile list" to view all profiles. 👉 To start a cluster, run: "minikube start" blue.io green.io. I resorted to updating file manually using nano command, by deleting message from above, and entering a line manually: xxx.xxx.99.100 blue.io green.io $ nano /etc/hosts I wonder why code sudo bash -c.... did not update configuration file as expected. Further information: - code is run on a ubuntu Linux VM with enabled nested virtualisation, - running a minikube cluster(kubernetes) - 2 configuration maps are setup to customise each of the webservers from a yaml file I read posts like [Webserver /etc/hosts file questions](https://unix.stackexchange.com/questions/710857/webserver-etc-hosts-file-questions) but I could not find the answer to my question.
Asked by josepmaria (103 rep)
Oct 30, 2024, 05:38 PM
Last activity: Oct 30, 2024, 09:49 PM