kubernetes-ingress: example is not working with with k8s v1.20.2
Running the example in the video with the code here (ab4d077a) results in the following:
$ kubectl apply -f dashboard-ingress.yaml
error: error validating "dashboard-ingress.yaml": error validating data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "serviceName" in io.k8s.api.networking.v1.IngressBackend, ValidationError(Ingress.spec.rules[0].http.paths[0].backend): unknown field "servicePort" in io.k8s.api.networking.v1.IngressBackend]; if you choose to ignore these errors, turn validation off with --validate=false
This appears to be due to changes in how io.k8s.api.networking.v1.IngressBackend maps the configuration (SO post here).
Changing the file so that paths
matches the following fixes that.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dashboard-ingress
namespace: kubernetes-dashboard
spec:
rules:
- host: dashboard.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: kubernetes-dashboard
port:
number: 80