sajad torkamani

What is an Ingress?

An Ingress in Kubernetes is a networking resource that routes external traffic from the outside world (e.g., HTTP requests) to the correct Service inside your cluster either by hostname or path.

For example, you might define the following configuration:

  • /api -> Service A
  • /web -> Service B
  • /support.example.com -> Service C

Example Ingress YAML

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

With the above config, Kubernetes will route incoming HTTP requests to http://example.com/api to the api-service Service on port 80.

Other notes

To use Ingress, you need to install an Ingress Controller like the Nginx Ingress Controller.

Tagged: Kubernetes