Complete the code to define an Ingress resource that manages external access.
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress spec: [1]: - host: example.com http: paths: - path: / pathType: Prefix backend: service: name: example-service port: number: 80
The rules field defines how Ingress routes external traffic to services inside the cluster.
Complete the code to specify the backend service port in the Ingress.
spec:
rules:
- host: example.com
http:
paths:
- path: /app
pathType: Prefix
backend:
service:
name: app-service
port:
number: [1]Port 80 is the standard HTTP port used for web traffic in Ingress backend services.
Fix the error in the Ingress pathType to correctly route traffic.
spec:
rules:
- host: example.com
http:
paths:
- path: /api
pathType: [1]
backend:
service:
name: api-service
port:
number: 80The Prefix pathType matches all paths that start with the given prefix, which is commonly used in Ingress.
Fill both blanks to configure TLS for Ingress external access.
spec:
tls:
- hosts:
- [1]
secretName: [2]The hosts field lists the domain names for TLS, and secretName specifies the TLS certificate secret.
Fill all three blanks to create an Ingress rule that routes traffic to a service on a specific path.
spec: rules: - host: [1] http: paths: - path: [2] pathType: [3] backend: service: name: web-service port: number: 80
The host is the domain name, path is the URL path to match, and pathType defines how the path is matched.