Updating Kubernetes Ingress from extensions/v1beta1 to networking.k8s.io/v1

kubernetes
2022-06-19 20:32 (2 years ago) ytyng

In the latest version of Kubernetes (around 1.25?), apiVersion: extensions/v1beta1 is no longer usable.

If you have written Ingress using extensions/v1beta1, you will encounter the following error when applying with kubectl:

error: unable to recognize "ingress.yml": no matches for kind "Ingress" in version "extensions/v1beta1"

Therefore, you need to update it to apiVersion: networking.k8s.io/v1.

Although I have not confirmed whether apiVersion: networking.k8s.io/v1beta1 is also unusable, it would be wise to similarly update to apiVersion: networking.k8s.io/v1 to avoid future issues.

When doing so, note that the way to write backend.service has slightly changed.

Sample Manifest for apiVersion: networking.k8s.io/v1 with kind: Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-app-ingress
namespace: my-namespace
annotations:
ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- secretName: my-tls-cert-secrets
rules:
- host: my-app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-app-service
port:
number: 80

In extensions/v1beta1, what was written as backend.serviceName and backend.servicePort has now been changed to backend.service.name and backend.service.port.number.
You also need to specify pathType. For the same behavior as before, use pathType: Prefix.

Currently unrated

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011