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

Rejecting admission review because the request does not contain an Ingress resource but networking.k8s.io/v1, Kind=Ingress #7305

Closed
cmoulliard opened this issue Jun 30, 2021 · 8 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@cmoulliard
Copy link

Versions

NGINX Ingress controller version: 0.47
Deploy yml file: master
Kubernetes version: 1.21.1
Environment: MacOS
Install tools: kind (version 0.11.1)

What happened

When we deploy an ingress resource on a kubernetes cluster 1.21.1 where ingress has been deployed using this file: https://github.com/kubernetes/ingress-nginx/blob/master/deploy/static/provider/kind/deploy.yaml
then we got this error from the ingress controller and of course the resource is not installed

E0630 06:35:31.286865       7 server.go:84] "failed to process webhook request" 
err="rejecting admission review because the request does not contain 
an Ingress resource but networking.k8s.io/v1, Kind=Ingress 
with name demo in namespace demo"

This error is due to the fact that the controller, during webadmission checks, expects to get a resource of type v1beta1 and not v1.
See this line: https://github.com/kubernetes/ingress-nginx/blob/controller-v0.47.0/internal/admission/controller/main.go#L49

The problem is due to the fact that the version master or v1.0.0-alpha.1 of the deploy.yaml file still installs the old version released of the controller which is 0.47 - https://github.com/kubernetes/ingress-nginx/blob/master/deploy/static/provider/kind/deploy.yaml#L327
and not the master branch code where the version verified is v1 as you can see here: https://github.com/kubernetes/ingress-nginx/blob/master/internal/admission/controller/main.go#L47

Remark: The error message logged is not correct as it should mention

rejecting admission review because the request contains an Ingress resource : networking.k8s.io/v1, Kind=Ingress while we expect a resource: networking.k8s.io/v1beta1, Kind=Ingress"

What you expected to happen

Ingress resource should be installed and no error returned

How to reproduce it

  • kind cluster create
cat <<EOF | kind create cluster --name ingress-dev --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
        authorization-mode: "AlwaysAllow"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF
cat <<EOF | kubectl -n demo apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo
spec:
  rules:
    - host: sb-demo.127.0.0.1.nip.io
      http:
        paths:
          - backend:
              service:
                name: demo
                port:
                  name: http
            path: /
            pathType: Prefix
EOF
  • You will get this error Error from server (InternalError): error when creating "STDIN": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": an error on the server ("") has prevented the request from succeeding
  • Check log of the ingress-controller pod
- E0630 09:00:34.305224       8 server.go:84] "failed to process webhook request" err="rejecting admission review because the request does not contain an Ingress resource but networking.k8s.io/v1, Kind=Ingress with name demo in namespace demo"

Resource deployed

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: demo
spec:
  rules:
    - host: sb-demo.127.0.0.1.nip.io
      http:
        paths:
          - backend:
              service:
                name: demo
                port:
                  name: http
            path: /
            pathType: Prefix
@cmoulliard cmoulliard added the kind/bug Categorizes issue or PR as related to a bug. label Jun 30, 2021
@aojea
Copy link
Member

aojea commented Jun 30, 2021

ping @rikatz

@rikatz
Copy link
Contributor

rikatz commented Jul 1, 2021

/assign @cpanato

@cpanato
Copy link
Member

cpanato commented Jul 1, 2021

thanks for opening this issue @cmoulliard
we did some tests and if you use the manifests from the main branch (aka master) it will fail because it is listening only to the V1 objects

I recommend you to use the manifests from the release-v1beta1 branch, for kind : https://raw.githubusercontent.com/kubernetes/ingress-nginx/release-v1beta1/deploy/static/provider/kind/deploy.yaml

tested using the manifest above and works fine

@cpanato
Copy link
Member

cpanato commented Jul 1, 2021

I will close this issue because if you use the manifests from the release-v1beta1 it works

/close

@k8s-ci-robot
Copy link
Contributor

@cpanato: Closing this issue.

In response to this:

I will close this issue because if you use the manifests from the release-v1beta1 it works

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@BenTheElder
Copy link
Member

xref: kubernetes-sigs/kind#2306

@oldthreefeng
Copy link

thanks for opening this issue @cmoulliard we did some tests and if you use the manifests from the main branch (aka master) it will fail because it is listening only to the V1 objects

I recommend you to use the manifests from the release-v1beta1 branch, for kind : https://raw.githubusercontent.com/kubernetes/ingress-nginx/release-v1beta1/deploy/static/provider/kind/deploy.yaml

tested using the manifest above and works fine

this file seems 404: Not Found

@longwuyuan
Copy link
Contributor

@oldthreefeng, try the recent release of the controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

8 participants