Question
Deploy an Ingress resource called multi-host-ingress with following configuration:
backend path: /video
backend service: web-service
backend port: 8080
hostname: web.example.com
backend path: /
backend service: search-service
backend port: 9000
hostname: search.example.com
AnswerapiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: multi-host-ingress
spec:
rules:
- host: "web.example.com"
http:
paths:
- pathType: Prefix
path: "/video"
backend:
service:
name: web-service
port:
number: 8080
- host: "search.example.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: search-service
port:
number: 9000
Apply and verify:
kubectl apply -f i.yaml
kubectl describe ingress multi-host-ingress