Kubernetes Ingress vs. Service with externalIPs

1/25/2019

If I expose a (single) web service (say http://a.b.c.d or https://a.b.c.d) on a (small) Kubernetes 1.13 cluster, what is the benefit of using Ingress over a Service of type ClusterIP with externalIPs [ a.b.c.d ] alone?

The address a.b.c.d is routed to one of my cluster nodes. Ingress requires installing and maintaining an ingress controller, so I am wondering when this is justified.

-- rookie099
kubernetes
kubernetes-ingress

2 Answers

1/30/2019

I've now come across a first concrete example where I see concrete benefit from using Ingress over a Service with externalIPs.

A private Docker registry inside a Kubernetes cluster normally requires TLS credentials. With the Docker image registry:2 one would have to mount those credentials e.g. from a ConfigMap into the container and have certain environment variables in the container (e.g. REGISTRY_HTTP_TLS_CERTIFICATE) point to them.

As long as one can tolerate insecure access to the registry inside the cluster this becomes easier to mange with Ingress. Certificates can be put into a Secret which the Ingress resource can point to (kubectl explain ingress.spec.tls.secretName). There is no more need to pay alternative detailed attention to mounts or environment variables. TLS connections will be terminated at the ingress controller.

-- rookie099
Source: StackOverflow

1/25/2019
  • Each service of type ClusterIP has its own public IP address, whereas an Ingress only requires single IP even if you want to provide access to dozens of services.
  • You can also forward the client requests to the corresponding service based on the host and path based routing provided by Ingress.
  • As Ingresses operate at layer 7 (application layer), it can also provide features like cookie-based session, which is not possible via services.
-- Vikram Jakhar
Source: StackOverflow