Complete the code to create a Kubernetes Ingress resource that uses a Load Balancer.
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 the Ingress routes traffic based on host and path.
Complete the command to create a GKE Ingress resource with a Load Balancer.
kubectl [1] -f ingress.yamlThe kubectl apply command creates or updates resources from a file.
Fix the error in the Ingress YAML by completing the missing field for backend service port number.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-ingress
spec:
rules:
- host: test.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: test-service
port:
number: [1]The port number must be a numeric value like 80 for HTTP traffic.
Fill both blanks to define a backend service and port in the Ingress spec.
backend:
service:
name: [1]
port:
number: [2]The backend service name is my-service and the port number is 80 for HTTP.
Fill all three blanks to create a complete Ingress rule with host, path, and backend service port.
rules: - host: [1] http: paths: - path: [2] pathType: Prefix backend: service: name: example-service port: number: [3]
The host is myapp.example.com, the path is /app, and the backend port is 80 for HTTP traffic.