Complete the code to specify the kind of resource for an Ingress in Kubernetes.
apiVersion: networking.k8s.io/v1
kind: [1]
metadata:
name: example-ingressThe kind field must be set to Ingress to define an Ingress resource in Kubernetes.
Complete the code to specify the backend service name in an Ingress rule.
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: [1]
port:
number: 80The name under service must match the name of the backend service to route traffic to. Here, nginx-service is the correct backend service name.
Fix the error in the annotation to enable the NGINX ingress controller to rewrite the target URL.
metadata:
annotations:
nginx.ingress.kubernetes.io/[1]: "/newpath"The correct annotation key to rewrite the target URL in NGINX ingress is nginx.ingress.kubernetes.io/rewrite-target.
Fill both blanks to define a Traefik IngressRoute with a rule matching the host and forwarding to a service.
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: example-ingressroute
spec:
entryPoints:
- web
routes:
- match: Host(`[1]`)
kind: Rule
services:
- name: [2]
port: 80The match field should specify the host to match, here example.com. The name under services should be the backend service name, here backend-service.
Fill all three blanks to create an NGINX ingress rule that routes traffic to a service on a specific path with TLS enabled.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: secure-ingress
annotations:
nginx.ingress.kubernetes.io/[1]: "true"
spec:
tls:
- hosts:
- [2]
secretName: tls-secret
rules:
- host: [3]
http:
paths:
- path: /secure
pathType: Prefix
backend:
service:
name: secure-service
port:
number: 443The annotation nginx.ingress.kubernetes.io/ssl-redirect set to true enables HTTPS redirect. The hosts and host fields must match the domain name, here secure.example.com.