I've created two services.
myymlservice
mysql-deployment
myymlservice needs the IP address of the load balancer of mysql-deployment (so it can create a connection string to it)
minikube service list
|-------------|----------------------|--------------------------------|
| NAMESPACE | NAME | URL |
|-------------|----------------------|--------------------------------|
| default | kubernetes | No node port |
| default | mysql-deployment | http://192.168.99.100:30928 |
| default | myymlservice | http://192.168.99.100:32724 |
| | | http://192.168.99.100:31461 |
| kube-system | kube-dns | No node port |
| kube-system | kubernetes-dashboard | No node port |
|-------------|----------------------|--------------------------------|
..
kubectl describe service mysql-deployment
Name: mysql-deployment
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"mysql-deployment","namespace":"default"},"spec":{"ports":[{"port":1433,"protoc...
Selector: app=mysql
Type: LoadBalancer
IP: 10.107.53.255
Port: <unset> 1433/TCP
TargetPort: 1433/TCP
NodePort: <unset> 30928/TCP
Endpoints: 172.17.0.7:1433
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
How (with yml) does one service (or the containers that support the service) get the IP address ?
More of my setup at the previous question:
single service with multiple exposed ports on a pod with multiple containers
If you want to build the connection string you can use the service name instead of ip. for instance mysql-deployment.default.svc.cluster.local. That is because kubernetes has a "dns" built-in and dns resolution