最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

kubernetes - Pods not able to communicate via service url (created with Kustomize) - Stack Overflow

programmeradmin0浏览0评论

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.

Share Improve this question edited 2 days ago Ruik asked Feb 6 at 15:58 RuikRuik 1,3611 gold badge21 silver badges40 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Damn 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.

发布评论

评论列表(0)

  1. 暂无评论