Ingress API changes from beta to GA

2 min read | by Jordi Prats

In kubernetes it has become common practice to use objects that are not yet GA, for instance: The Kubernetes team graduated the Ingress API to general availability (GA) in the 1.19 release (September 25th, 2020): it was first introduced in 2015. But there's one drawback that we really need to be aware: Using a alpha or beta API means that the interface might change and, for Ingress, it did change.

Let's take this Ingress yaml using extensions/v1beta1 as an example:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: beta-ingress
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internal
    alb.ingress.kubernetes.io/target-type: ip
spec:
  rules:
    - http:
        paths:
          - backend:
              serviceName: example
              servicePort: 8080
            path: /*

If we try to apply it on a 1.19+ kubernetes cluster, we will get a warning message like this:

$ kubectl apply -f beta-ingress.yaml
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
ingress.extensions/testingress created

It is using the beta version, if we take a look at the Ingress documentation we can see how we will have to modify the YAMLs from the beta version to use the GA. Unfortunately, for the Ingress it's not going to be just to change the apiVersion, we will have to also change the spec:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: spinnaker
  name: spin-gate
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internal
    alb.ingress.kubernetes.io/target-type: ip
spec:
  rules:
    - http:
        paths:
          - path: /*
            pathType: Prefix
            backend:
              service:
                name: spin-gate
                port:
                  number: 8084

For a beta API is something that can happen, but be aware that for alpha APIs you should be almost sure that this is going to happen.


Posted on 25/02/2021

Categories