I have a single node with microk8s running. And the DNS plugin is defenitly enabled. But still pods cannot communitcate via the services, direct access via pod IP is working.
I read in kubernetes cannot ping another service that pinging a service doesn't work. Since the connection problem is with a Postgres container I'm testing with psql from inside another pod :
psql -h service-name -U postgres -d db_name # doesn't work with service name
psql -h 10.152.183.98 -U postgres -d db_name # doesn't work with service ClusterIP
psql -h 10.1.100.73 -U postgres -d db_name # but works with pod IP
If I do nslookup service-name
the service IP is detected. But the problem seems to be to forward from the service to the pod. Not even from within the postgres pod itself a connection to the service works.
I have a single node with microk8s running. And the DNS plugin is defenitly enabled. But still pods cannot communitcate via the services, direct access via pod IP is working.
I read in kubernetes cannot ping another service that pinging a service doesn't work. Since the connection problem is with a Postgres container I'm testing with psql from inside another pod :
psql -h service-name -U postgres -d db_name # doesn't work with service name
psql -h 10.152.183.98 -U postgres -d db_name # doesn't work with service ClusterIP
psql -h 10.1.100.73 -U postgres -d db_name # but works with pod IP
If I do nslookup service-name
the service IP is detected. But the problem seems to be to forward from the service to the pod. Not even from within the postgres pod itself a connection to the service works.
1 Answer
Reset to default 0Damn I found the error. I set a commonLabel with Kustomize for all 4 services/deployments/pods of my stack.
commonLabels:
app: myapp
That overwrote the app labels from all 4 services and the whole selector mechanism matching services to pods broke because of that. Removing the common Label app fixed it.