We are using the networking.k8s.io/v1beta1 and we trying to move to networking.k8s.io/v1 with the following changes and my ingress.YAML code looks like this now.
Version:"v1.20.15-gke.2500"
When I applied the "kubectl apply" I got to see the following error, could someone help me why I am facing this error?
error: error validating "ingress.yaml": error validating data: [ValidationError(Ingress.spec.rules[0].http.paths[0].backend.service.port): invalid type for io.k8s.api.networking.v1.ServiceBackendPort: got "integer", expected "map", ValidationError(Ingress.spec.rules[0].http.paths[1].backend.service.port): invalid type for io.k8s.api.networking.v1.ServiceBackendPort: got "integer", expected "map", ValidationError(Ingress.spec.rules[0].http.paths[2].backend.service.port): invalid type for io.k8s.api.networking.v1.ServiceBackendPort: got "integer", expected "map"; if you choose to ignore these errors, turn validation off with --validate=false
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ***
annotations:
kubernetes.io/ingress.global-static-ip-name: ****
networking.gke.io/managed-certificates: *****
spec:
rules:
- host: ***
http:
paths:
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- host: *********
http:
paths:
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
- path: /****/*
pathType: Prefix
backend:
service:
name: *********
port: 50000
You are using incorrect syntax for
networking.k8s.io/v1
Ingress. The error is saying that thebackend.service.port
is no longer an integer, it expects a map.In
apiVersion: networking.k8s.io/v1beta1
, thebackend
section looks like below:Now in
apiVersion: networking.k8s.io/v1
:Sample YAML: