Sobes.tech
Junior — Middle

Can you explain what Kubernetes Ingress is and how it is used?

sobes.tech AI

Answer from AI

Kubernetes Ingress is an object that manages external access to services within a Kubernetes cluster, usually via HTTP/HTTPS. Ingress allows you to configure routing rules for requests based on URL or host to the appropriate services, and also provides SSL termination and load balancing capabilities.

Example of usage: you can set up an Ingress so that requests to example.com/api go to one service, and requests to example.com/web go to another.

Example Ingress manifest:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /api
        pathType: Prefix
        backend:
          service:
            name: api-service
            port:
              number: 80
      - path: /web
        pathType: Prefix
        backend:
          service:
            name: web-service
            port:
              number: 80

The Ingress controller (for example, NGINX Ingress Controller) is responsible for implementing these rules and routing traffic.