Hi all, I have got one more question. Sorry to post too many questions. I am se . . .

Vasu BK:
Hi all,
I have got one more question. Sorry to post too many questions. I am seriously looking forward for you experts help.

This question is regarding ingress creation. Here is my yaml cotent.


controlplane $ cat pay-ingress.yaml
#apiVersion: extensions/v1beta1 --> Tried with this first
apiVersion: http://networking.k8s.io/v1beta1|networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: test-ingress
namespace: critical-space
annotations:
http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:

  • http:
    paths:
    • path: /pay
      backend:
      serviceName: pay-service
      servicePort: 8080

When I try to create it, I get below warning.

controlplane kubectl create -f pay-ingress.yaml Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use <http://networking.k8s.io/v1|networking.k8s.io/v1> Ingress ingress.extensions/test-ingress created controlplane

Then, I looked at the documentation and changed the apiVersion accordingly, as mentioned in my yaml.

Then also I get below warning when create ingress.

controlplane kubectl create -f pay-ingress.yaml Warning: <http://networking.k8s.io/v1beta1|networking.k8s.io/v1beta1> Ingress is deprecated in v1.19+, unavailable in v1.22+; use <http://networking.k8s.io/v1|networking.k8s.io/v1> Ingress <http://ingress.networking.k8s.io/test-ingress|ingress.networking.k8s.io/test-ingress> created controlplane

Then, I updated again apiVersion to “apiVersion: http://networking.k8s.io/v1|networking.k8s.io/v1”.

Then, it altogether fails with below error.

controlplane kubectl create -f pay-ingress.yaml error: error validating "pay-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 controlplane

So, can you educate me why this error though I used right apiVersion as per Warning?

Finally, I had to revert to older version, creation happens inspite of the Warning.

Tej_Singh_Rana:
Hello, @Vasu BK
It’s just a warning, nothing else.
In v1.19+, api version http://networking.k8s.io/v1beta1 is deprecated that means not prefer to use and will be remove in future release v1.22.

Tej_Singh_Rana:
So use correct apiVersion according to k8s version.

Tej_Singh_Rana:
Please check for current apiVersion and Ingress details:
https://kubernetes.io/docs/concepts/services-networking/ingress/

Tej_Singh_Rana:
Be familiar to the docs, good when you will use during the exam.

Shwetha Shenoy V:
@Vasu BK The failure when using http://networking.k8s.io/v1|networking.k8s.io/v1 version is because the serviceName and servicePort fields aren’t a part of the spec.
Check this example: https://kubernetes.io/docs/concepts/services-networking/ingress/#the-ingress-resource

Hikmat Ullah:
Only use the service field without Name as in official docs

Vasu BK:
Thank u all for your responses