Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch15 - deprecated apiVersion for ingress object #32

Open
nicolimo86 opened this issue Feb 16, 2022 · 3 comments
Open

ch15 - deprecated apiVersion for ingress object #32

nicolimo86 opened this issue Feb 16, 2022 · 3 comments

Comments

@nicolimo86
Copy link

Hello,
in ch15 the manifests for the ingress object have the deprecated value networking.k8s.io/v1beta1. This makes them failing on kubernetes servers with version 1.18 or newer.

The correct apiVersion is now "apiVersion: networking.k8s.io/v1"

@Alibirb
Copy link

Alibirb commented Feb 28, 2022

This is not just in chapter 15. Throughout the book, yaml files are using beta api versions that no longer exist. Changing it to "v1" usually seems to solve the issue.
However, the nginx ingress configuration requires further changes, because the container itself tries to use the deprecated api, even if the manifests are updated to the correct api version.

@nicolimo86
Copy link
Author

@WriterOfAlicrow correct, many things are already different. I tried to change the manifests for chapter 15. I tested several of them, and they seem to work now.

@Alibirb
Copy link

Alibirb commented Mar 1, 2022

I managed to get this to work, at least for the hello-kiamol app (haven't tested the others yet), but it required some changes beyond what @nicolimo86 needed. I'm running kubernetes 1.22, which I think removed or changed more things.

In the Ingress definition files I had to:

  • Update the apiVersions to v1
  • Change serviceName and servicePort to service.name and service.port.number
  • add pathType: Prefix to the path specification
  • add annotations: kubernetes.io/ingress.class: "nginx" to the metadata

In nginx-ingress-controller.yaml, I had to:

  • Update the image version to k8s.gcr.io/ingress-nginx/controller:v1.1.1@sha256:0bc88eb15f9e7f84e8e56c14fa5735aaa488b840983f87bd79b1054190e660de so it uses the right API version
  • Change ingress-controller-leader-nginx to ingress-controller-leader in the Role specification so it had access to update the right resource.
  • Add an IngressClass specification at the bottom on the file containing:
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  labels:
    app.kubernetes.io/component: controller
  name: nginx
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: k8s.io/ingress-nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants