I'm building a K8 cluster for a school project. It's bare metal and uses metallb as a loadbalancer. Each service works in a separate pod:
- Nginx
- Wordpress
- Phpmyadmin
- Mysql (mariadb)
In the phpmyadmin file, I need to link my mysql server with something like this:
$cfg['Servers'][$i]['host'] = "mysql-server-name";
I've tried to use the node's IP:
kubectl get node -o=custom-columns='DATA:status.addresses[0].address' | sed -n 2p
adding the port :3306 but I realised that none of my services could be reached through the browser with this method. For instance the node's Ip:5050 should redirect me to my wordpress but it doesn't. Is there any way to get a single IP that I can use to make my pods communicate between them ? I must add that each service works appart when I use the svc IP instead of the nodes.
Here's the configmap I use for metallb:
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.99.100-192.168.99.200