简体   繁体   English

Kubernetes-有服务入口-类型可以为ClusterIP吗

[英]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.

相关问题 Kubernetes:我何时必须使用Ingress + ClusterIP选择上面类型的loadbalancer服务? - Kubernetes: When do I have to choose a service of type loadbalancer above using ingress + ClusterIP? Ingress 使用 clusterIP 类型公开服务 - Ingress expose the service with the type clusterIP Kubernetes 中进入 ClusterIP 和 Headless 服务的入口路由连接有什么区别? - What is the different between ingress route connection into ClusterIP and Headless service in Kubernetes? 在 Azure Kube.netes 服务 (AKS) 中,我有一个类型为“ClusterIP”的服务,它是否在内部执行 pod 的负载平衡? - In Azure Kubernetes Service (AKS) I have a Service of type "ClusterIP", does it perform the pod's load balancing internally? 为什么我不能将服务类型 ClusterIP 附加到 GKE 上的 Ingress? - Why can't I attach a service type ClusterIP to Ingress on GKE? GCE Ingress 资源和 ClusterIP 服务 - GCE Ingress resource and ClusterIP service NGINX 入口未到达服务(clusterIP) - NGINX Ingress is not reaching Service(clusterIP) 在 kubernetes 中使用 ClusterIP 服务类型的外部 IP 地址有什么用 - what is the use of external IP address with a ClusterIP service type in kubernetes 如何在Kubernetes中获得服务类型为ClusterIP的客户端IP地址 - How to get client IP address in Kubernetes with service type ClusterIP 在Kubernetes上使用服务类型clusterip时如何避免出现小巧? - how to avoid snat when using service type clusterip on kubernetes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM