如何通过kubernetes集群IP访问服务? [英] How to access services through kubernetes cluster ip?

查看:205
本文介绍了如何通过kubernetes集群IP访问服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过kubeadm构建了一个kubernetes集群,并创建了一些服务.可以通过节点ip:端口从外部访问这些服务,但是当我尝试通过群集ip访问该服务失败时,它将显示错误消息curl:(7)无法连接到10.99.237.89:2379;失败.连接超时,请问该如何解决问题?

I built a kubernetes cluster through kubeadm and created several services. These services can be accessed externally through the node ip: port, but when I try to access the service through cluster ip, it fails, it displays the error message curl: (7) Failed connect to 10.99.237.89:2379; Connection timed out, this How to solve the problem?

与集群相关的信息

[root@********** ~]# kubectl describe svc etcd-torus-internal --namespace=default
Name:                   etcd-torus-internal
Namespace:              default
Labels:                 name=etcd-torus-internal
Selector:               name=etcd-torus
Type:                   ClusterIP
IP:                     10.99.237.89
Port:                   etcd-client     2379/TCP
Endpoints:              10.244.1.10:2379
Session Affinity:       None
No events.
[root@********** ~]# curl 10.99.237.89:2379
curl: (7) Failed connect to 10.99.237.89:2379; Connection timed out
[root@********** ~]#

推荐答案

无法从群集外部访问群集IP,它们只能在内部使用.

Cluster IPs are not accessible from outside the cluster, they are internal only.

有关详情,请参见此处详细信息

See here for more details

这篇关于如何通过kubernetes集群IP访问服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆