Kubernetes中Main Pod无法与Other Pod通信问题求助
问题:Main Pod无法访问Other Pod的端点
我有两个Pod:Main Pod和Other Pod。Main Pod的一个端点需要调用Other Pod的端点获取结果。两个Pod均配置了ClusterIP类型的Service,且Main Pod还配置了Ingress。目前Main Pod无法连接到Other Pod的指定端点。
从截图可见,/端点可正常工作,但/other端点请求失败。
相关配置文件
main-service.yaml
# main-service.yaml apiVersion: v1 kind: Service metadata: name: main-service labels: name: main-service-label spec: selector: app: main # label selector of pod, not the deployment type: ClusterIP ports: - port: 8001 protocol: TCP targetPort: 8001
other-service.yaml
# other-service.yaml apiVersion: v1 kind: Service metadata: name: other-service labels: name: other-service-label spec: selector: app: other # label selector of pod, not the deployment type: ClusterIP ports: - port: 8002 protocol: TCP targetPort: 8002
备注
- 使用
kubectl exec进入Other Pod后,可正常curl访问Main Pod,但反向无法实现,不清楚问题所在。 - 所有Pod和Service均位于default命名空间。
内容的提问来源于stack exchange,提问作者harshraj22
相关产品推荐
相关产品推荐

