nginxinc / nginx-gateway-fabric

NGINX Gateway Fabric provides an implementation for the Gateway API using NGINX as the data plane.
Apache License 2.0
502 stars 97 forks source link

Error: failed to call webhook while deploying NGINX Kubernetes Gateway #347

Closed bluedog13 closed 1 year ago

bluedog13 commented 1 year ago

Describe the bug I get the below error

Error from server (InternalError): error when creating "deploy/manifests/gatewayclass.yaml": Internal error occurred: failed calling webhook "validate.gateway.networking.k8s.io": failed to call webhook: Post "https://gateway-api-admission-server.gateway-system.svc:443/validate?timeout=10s": service "gateway-api-admission-server" not found

To Reproduce I am following the steps mentioned here to deploy NGINX Kubernetes Gateway. I see the above error at the below step

5. Create the GatewayClass resource:
kubectl apply -f deploy/manifests/nginx-gateway.yaml

Expected behavior Should be able to deploy NGINX Kubernetes Gateway

Your environment

Additional context Add any other context about the problem here. Any log files you want to share.

Aha! Link: https://nginx.aha.io/features/NKG-22

pleshakov commented 1 year ago

Hi @bluedog13

As part of the standard Gateway API installation -- https://gateway-api.sigs.k8s.io/guides/#install-standard-channel -- it installs the weebhook (https://github.com/kubernetes-sigs/gateway-api/tree/v0.5.1/config/webhook) . The error Error from server (InternalError): error when creating "deploy/manifests/gatewayclass.yaml": Internal error occurred: failed calling webhook "validate.gateway.networking.k8s.io": failed to call webhook: Post "https://gateway-api-admission-server.gateway-system.svc:443/validate?timeout=10s": service "gateway-api-admission-server" not found indicates that the webhook wasn't fully installed - the service wasn't created. I suggest reinstalling it.

At the same time, to try NGINX Kubernetes Gateway, it is not necessary to deploy the webhook -- so you can just deploy CRDs without the webhook, as described in step 2 https://github.com/nginxinc/nginx-kubernetes-gateway/blob/main/docs/installation.md#deploy-nginx-kubernetes-gateway , but make sure to remove any installed webhook-related resources.

bluedog13 commented 1 year ago

Thank you for the reply.

I did follow all the steps 1-4 before applying step 5. The error I came across was on step 5.

pleshakov commented 1 year ago

@bluedog13 I suggest removing any installed webhook-related files and try to install NGINX Gateway again. This way the API server will not try to validate any resources using the webhook and you won't see that error.

pleshakov commented 1 year ago

closing this issue due to inactivity