1
votes

I'm preparing all the Ingress manifest files to keep the latest apiVersion (networking.k8s.io/v1) to upgrade my cluster from 1.19 to 1.22.

I'm deleting the previous Ingress rule and then recreating:

k delete ingress/my-ingress
k create -f /tmp/ingress.yaml

Unfortunately, the Ingress is created but with apiVersion extensions/v1beta1 that's different for what I have on my manifest:

$ k get ingress/my-ingress -o yaml
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
  creationTimestamp: "2021-08-11T19:42:08Z"

Here is an example of the YAML I'm using:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
  labels:
    app.kubernetes.io/instance: my-app
    app.kubernetes.io/name: my-app
  name: my-ingress
  namespace: default
spec:
  rules:
  - host: application.com
    http:
      paths:
        - path: /
          pathType: ImplementationSpecific
          backend:
            service:
              name: my-app
              port:
                number: 443

Kubernetes version:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-18T12:09:25Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19+", GitVersion:"v1.19.13-eks-8df270", GitCommit:"8df2700a72a2598fa3a67c05126fa158fd839620", GitTreeState:"clean", BuildDate:"2021-07-31T01:36:57Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

Ingress controller version (I upgraded from 0.41 to avoid any kind of issues):

Image: k8s.gcr.io/ingress-nginx/controller:v0.48.1@sha256:e9fb216ace49dfa4a5983b183067e97496e7a8b307d2093f4278cd550c303899
1

1 Answers

1
votes

This is working as expected, in particular check github answer

When you create an ingress object, it can be read via any version - the server handles converting into the requested version. In your request get ingress/my-ingress -o yaml you not specified version, which should be read. In such case kubectl searches documents returned by the server to find the first among them with requested resource. And it can be any version, as in your case.

That is why, if you want to check particular version, you can:

  1. Improve your request with adding your manifest file, since version specified in the file
    $ kubectl get -f ingress.yaml -o yaml                                                                                                                
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      annotations:
        ...
  1. Other option is to qualify necessary version in get request:
    $ kubectl get ingresses.v1.networking.k8s.io
    NAME         CLASS    HOSTS             ADDRESS   PORTS   AGE
    my-ingress   <none>   application.com             80      12m

    $ kubectl get ingresses.v1beta1.networking.k8s.io
    Warning: networking.k8s.io/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
    NAME         CLASS    HOSTS             ADDRESS   PORTS   AGE
    my-ingress   <none>   application.com             80      13m