简体   繁体   English

在K8s中,我无法使用选择器应用程序中的群集IP远程登录到端口

[英]In K8s I can not telnet to the port using the cluster IP from selector app

I am searching for a long time on the net. 我在网上搜索了很长时间。 But no use. 但是没用。 Please help or try to give some ideas how to achieve this. 请帮助或尝试给出一些想法来实现这一目标。

Service definition: 服务定义:

{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "eureka1",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/services/eureka1",
    "uid": "aed393f1-d127-11e8-8f19-fa163e4dc428",
    "resourceVersion": "7432445",
    "creationTimestamp": "2018-10-16T09:41:40Z",
    "labels": {
      "k8s-app": "eureka1"
    }
  },
  "spec": {
    "ports": [
      {
      "name": "tcp-38761-8761-6fjms",
      "protocol": "TCP",
      "port": 80,
      "targetPort": 80,
      "nodePort": 8761
    }
  ],
  "selector": {
    "k8s-app": "eureka1"
  },
  "clusterIP": "10.254.65.233",
  "type": "NodePort",
  "sessionAffinity": "None",
  "externalTrafficPolicy": "Cluster"
  },
  "status": {
    "loadBalancer": {}
  }
}

kubectl describe service eureka1: kubectl描述服务eureka1:

Name:                     eureka1
Namespace:                default
Labels:                   k8s-app=eureka1
Annotations:              <none>
Selector:                 k8s-app=eureka1
Type:                     NodePort
IP:                       10.254.65.233
Port:                     tcp-38761-8761-6fjms  80/TCP
TargetPort:               80/TCP
NodePort:                 tcp-38761-8761-6fjms  8761/TCP
Endpoints:                172.101.51.8:80
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

kubectl get ep: kubectl获取ep:

NAME                         ENDPOINTS
eureka1                      172.101.51.8:80
eureka2                      172.101.52.8:80

If I in the eureka1 app telnet to 10.254.65.233 80 如果我在eureka1应用程序telnet中连接到10.254.65.233 80

Trying 10.254.65.233...
telnet: connect to address 10.254.65.233: Connection timed out

but I can ping 10.254.65.233 但我可以ping 10.254.65.233

Try another service IP not selector and can telnet. 尝试使用另一个服务IP而不是选择器,并且可以telnet。

The kube-proxy mode is ipvs kube-proxy模式是ipvs

Thanks 谢谢

this can happen when the network is not properly configured for “hairpin” traffic, usually when kube-proxy is running in iptables mode and Pods are connected with bridge network. 当网络没有针对“发夹”流量进行正确配置时,通常会发生这种情况,通常是当kube-proxyiptables模式下运行并且kube-proxy与网桥网络连接时。 The Kubelet exposes a hairpin-mode flag that allows endpoints of a Service to loadbalance back to themselves if they try to access their own Service VIP. Kubelet公开了一个hairpin-mode标志,该标志允许服务的端点在尝试访问自己的服务VIP时使其自身实现负载Kubelet The hairpin-mode flag must either be set to hairpin-veth or promiscuous-bridge . hairpin-mode标志必须设置为hairpin-vethpromiscuous-bridge

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 K8s 集群中检索容器镜像(不仅仅是列出容器镜像名称)? - How can I retrieve the container images from a K8s cluster (not just list the container image names)? 从 docker 容器访问默认命名空间中具有集群 IP 的 k8s 服务 - Accessing a k8s service with cluster IP in default namespace from a docker container 从 K8S 集群运行 cron 作业 - Running cron job from K8S cluster 将容器从Node / Angular UI部署到K8s集群 - Deploy containers from Node/Angular UI to K8s cluster k8s集群中从前端到后端的连接被拒绝 - connection refused from frontend to backend in k8s cluster 使用 k8s 之外的 k8s 节点资源 - Using k8s node resources out of k8s 我们可以使用 kops 将配置为在多节点 AWS EC2 K8s 集群上运行的应用程序运行到本地 kubernetes 集群(使用 kubeadm)吗? - Can we run an application that is configured to run on multi-node AWS EC2 K8s cluster using kops into local kubernetes cluster (using kubeadm)? 如何限制 k8s 中交换内存的使用? - How can I limit the usage of swap memory in k8s? 如何在没有 ssh 的情况下从主节点访问 k8s 工作节点? - How can i access a k8s worker node from a master node without ssh? 如何为在 K8s 集群之外的同一本地主机上运行的外部服务创建端点? - How do I create an Endpoint for an external service running on the same localhost outside of K8s cluster?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM