Kubernetes

Explain the meaning of "http", "host" and "backend" directives

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: someapp-ingress
spec:
  rules:
  - host: my.host
    http:
      paths:
      - backend:
          serviceName: someapp-internal-service
          servicePort: 8080

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

host is the entry point of the cluster so basically a valid domain address that maps to cluster's node IP address

the http line used for specifying that incoming requests will be forwarded to the internal service using http.

backend is referencing the internal service (serviceName is the name under metadata and servicePort is the port under the ports section).