kubernetescouchbase

Webhook call fails while deploying a new Couchbase cluster


I followed the steps mentioned in the following documents to install a fresh Couchbase cluster on Kubernetes:

  1. https://docs.couchbase.com/operator/current/install-kubernetes.html
  2. https://docs.couchbase.com/operator/2.4/howto-couchbase-create.html

I have installed kubernetes operator v 2.7 on my Kubernetes cluster v 1.28.1. The commands to install the custom resource definitions, operator and admission controller succeed.

When I run kubectl apply -f couchbase-cluster.yaml it gives me the following error:

secret/cb-example-auth created

Error from server (InternalError): error when creating "couchbase-cluster.yaml": Internal error occurred: failed calling webhook "release-1-couchbase-admission-controller.couchbase.svc": failed to call webhook: Post "https://release-1-couchbase-admission-controller.couchbase.svc:443/couchbaseclusters/validate?timeout=10s": service "release-1-couchbase-admission-controller" not found

Error from server (InternalError): error when creating "couchbase-cluster.yaml": Internal error occurred: failed calling webhook "release-1-couchbase-admission-controller.couchbase.svc": failed to call webhook: Post "https://release-1-couchbase-admission-controller.couchbase.svc:443/couchbaseclusters/validate?timeout=10s": service "release-1-couchbase-admission-controller" not found

These are the actual services created by cao:

NAME                           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)             AGE
couchbase-operator             ClusterIP   xx.xx.xx.xx   <none>        8080/TCP,8383/TCP   19m
couchbase-operator-admission   ClusterIP   xx.xx.xx.xx   <none>        443/TCP             19m

It seems while creating the cluster, Couchbase is looking for a different service name for the operator and admission controller than what was actually installed by cao. How can I solve this issue?


Solution

  • This looks to be a remnant of a previous installation that was not properly removed. You need to check your ValidatingWebhookConfigurations and remove the one named in the error message.

    By extension, I imagine the service related to that Webhook is also present, and likely just the deployment was deleted. I would recommend using the cao delete x to remove all associated resources with a deployment.