[英]Kubernetes - Have an ingress on a service - is it ok for its type to be ClusterIP
I have a Kubernetes services that I would like to be accessible from outside the cluster. 我想要从集群外部访问Kubernetes服务。
I've setup Traefik and have created an Ingress file for that service and am able to go to 'somemadeupdomain.com' and access the service fine. 我已经设置了Traefik并为该服务创建了一个Ingress文件,并且能够转到“ somemadeupdomain.com”并正常访问该服务。 (Having locally added a line in my hosts file).
(在本地在我的主机文件中添加了一行)。
However my question is with the service type
, I've currently set as ClusterIP
. 但是我的问题是关于服务
type
,我目前已设置为ClusterIP
。 I can access the service fine, so is it fine to continue to use that or should I use NodePort
. 我可以正常访问该服务,因此继续使用该服务还是应该使用
NodePort
。
Of course if I use NodePort
I'm aware that when doing minikube service list
I'll get a specific URL created by Kubernetes to access that service, but I feel I don't need to do that as I have that ingress file? 当然,如果我使用
NodePort
我知道在做minikube service list
我会得到一个由Kubernetes创建的特定URL来访问该服务,但是我感觉不需要,因为有了入口文件?
Any explanation would be appreciated. 任何解释将不胜感激。
Thanks 谢谢
As you are using ingress already it does not make much sense to use NodePort. 当您已经在使用入口时,使用NodePort并没有多大意义。 As you already have a way to access your application.
您已经可以访问应用程序了。 Its totally fine to have a service type you need at service level that you need for the internal access(within Kubernets) purpose.
在内部访问(在Kubernets中)用途所需的服务级别上具有所需的服务类型是完全可以的。
Ingress will redirect your external traffic to your service within the cluster , so ClusterIP
is a good choice. Ingress会将您的外部流量重定向到群集内的服务,因此
ClusterIP
是一个不错的选择。 No need to use NodePort
. 无需使用
NodePort
。 From Documentation 从文档
Ingress, added in Kubernetes v1.1, exposes HTTP and HTTPS routes from outside the cluster to services within the cluster
Kubernetes v1.1中添加的Ingress公开了从集群外到集群内服务的HTTP和HTTPS路由
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.