kubernetes - 在同一节点上运行的Pod无法通过服务相互访问

标签 kubernetes

我已经使用kubspray Azure2.13.2上安装了一个kubernetes集群。
但是在我安装了数据平台组件的一些容器之后,
我注意到在同一节点上运行的Pod无法通过服务彼此访问。
例如,我的presto协调员必须访问hive metastore。
让我们看看我的命名空间中的服务:

kubectl get svc -n ai-developer
NAME                                              TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)                      AGE
metastore                                 ClusterIP      10.233.12.66    <none>           9083/TCP                     4h53m
Hive Metastore服务称为metastore,我的协调员必须通过该服务访问Hive Metastore Pod。
让我们在我的命名空间中查看以下pod:
kubectl get po -n ai-developer -o wide
NAME                                          READY   STATUS      RESTARTS   AGE     IP             NODE       NOMINATED NODE   READINESS GATES
metastore-5544f95b6b-cqmkx                    1/1     Running     0          9h      10.233.69.20   minion-3   <none>           <none>
presto-coordinator-796c4c7bcd-7lngs           1/1     Running     0          5h32m   10.233.69.29   minion-3   <none>           <none>
presto-worker-0                               1/1     Running     0          5h32m   10.233.67.52   minion-1   <none>           <none>
presto-worker-1                               1/1     Running     0          5h32m   10.233.70.24   minion-4   <none>           <none>
presto-worker-2                               1/1     Running     0          5h31m   10.233.68.24   minion-2   <none>           <none>
presto-worker-3                               1/1     Running     0          5h31m   10.233.71.27   minion-0   <none>           <none>
看一下在节点metastore-5544f95b6b-cqmkx 上运行的配置单元metastore pod minion-3,presto协调器pod presto-coordinator-796c4c7bcd-7lngs也在其上运行。
我已将thrift://metastore:9083的配置单元metastore url配置为presto协调器中的配置单元目录的配置单元属性。
当presto Pod在运行Hive Metastore Pod的同一节点上运行时,它们无法访问我的Hive Metastore,但是在未运行Hive Metastore的其他节点上运行的Pod可以很好地通过service访问Hive Metastore。
我只提到了一个示例,但是到目前为止,我还经历了类似此示例的其他几种情况。kubenet作为网络插件安装在我的kubernetes集群中,该集群通过azure上的kubespray安装:
/usr/local/bin/kubelet --logtostderr=true --v=2 --node-ip=10.240.0.4 --hostname-override=minion-3 --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --config=/etc/kubernetes/kubelet-config.yaml --kubeconfig=/etc/kubernetes/kubelet.conf --pod-infra-container-image=k8s.gcr.io/pause:3.1 --runtime-cgroups=/systemd/system.slice --hairpin-mode=promiscuous-bridge --network-plugin=kubenet --cloud-provider=azure --cloud-config=/etc/kubernetes/cloud_config
任何的想法?

最佳答案

请检查iptables Chain FORWARD默认策略是否为ACCEPT。
在我的情况下,将转发链默认策略从drop设置为accept,节点之间的通信效果很好。

关于kubernetes - 在同一节点上运行的Pod无法通过服务相互访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64073696/

相关文章:

amazon-web-services - 如何解决 cloudflare CNAME 记录上的 521 错误

kubernetes - kubernetes 上的 prometheus 节点导出器

python - 如何为dask_kubernetes配置jupyterlab?

docker - 我们如何在 kubernetes 部署 yaml 中获得像 pod id 或容器 id 这样的独特信息

kubernetes - 在一个部署中装入两个持久卷声明会导致错误

kubernetes - 无法从 Prometheus-Adapter 访问默认的 k3s 指标服务器

kubernetes - 在 kubernetes 中通过 YML 将 locust 文件复制到卷中

go - 如何使用client-go访问kubernetes CRD?

kubernetes - Pod的kubectl日志(如果包含2个容器)