I'm using Microk8s Kubectl in Ubuntu server, I was following some tutorials from Nana's YouTube channel and she explained, for example, how to connect a Mongo Express service to a MongoDB service, however I'm getting an error.
I actually used her files provided here and the problem persists, so I wonder if I have to do anything extra in Microk8s.
Error shown in Mongo Express logs (using her files):
/docker-entrypoint.sh: line 14: mongodb-service: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongodb-service/27017: Invalid argument
retrying to connect to mongodb-service:27017
Any help is welcome, thank you very much :)
The problem was the coredns deployment wasn't working properly, pod shown as
0/1, you can check these by running:
get all --namespace kube-system, therefore Mongo Express wasn't finding MongoDB by the DNS.
I found the following command that displayed some other problems:
Then I did as the inspection suggested:
sudo ufw allow in on cni0
sudo ufw allow out on cni0
sudo apt install iptables-persistent
Upon doing so everything worked correctly!