Search code examples
kubectlmetallb

kubectl wait - error: no matching resources found


I am installing metallb, but need to wait for resources to be created.

kubectl wait --for=condition=ready --timeout=60s -n metallb-system --all pods

But I get:

error: no matching resources found

If I dont wait I get:

Error from server (InternalError): error when creating "STDIN": Internal error occurred: failed calling webhook "ipaddresspoolvalidationwebhook.metallb.io": failed to call webhook: Post "https://webhook-service.metallb-system.svc:443/validate-metallb-io-v1beta1-ipaddresspool?timeout=10s": dial tcp 10.106.91.126:443: connect: connection refused

Do you know how to wait for resources to be created before actually be able to wait for condition.

Info:

kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.4", GitCommit:"872a965c6c6526caa949f0c6ac028ef7aff3fb78", GitTreeState:"clean", BuildDate:"2022-11-09T13:36:36Z", GoVersion:"go1.19.3", Compiler:"gc", Platform:"linux/arm64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.4", GitCommit:"872a965c6c6526caa949f0c6ac028ef7aff3fb78", GitTreeState:"clean", BuildDate:"2022-11-09T13:29:58Z", GoVersion:"go1.19.3", Compiler:"gc", Platform:"linux/arm64"}

Solution

  • For the error “no matching resources found”:

    Wait for a minute and try again, It will be resolved.

    You can find the explanation about that error in the following link Setting up Config Connector

    For the error STDIN:

    Follow the steps mentioned below:

    You are getting this error because API server is NOT able to connect to the webhook

    1)Check your Firewall Rules allowing TCP port 443 or not.

    2)Temporarily disable the operator

      kubectl -n config-management-system scale deployment config-management-operator --replicas=0
        deployment.apps/config-management-operator scaled
    

    Delete the deployment

    kubectl delete deployments.apps  -n <namespace> -system <namespace>-controller-manager
    deployment.apps "namespace-controller-manager" deleted
    

    3)create a configmap in the default namespace

    kubectl create configmap foo
    configmap/foo created
    

    4)Check that configmap does not work with the label on the object

    cat <<EOF | kubectl create -f -
    apiVersion: v1
    kind: ConfigMap
    metadata:
      labels:
        configmanagement.gke.io/debug-force-validation-webhook: "true"
      name: foo
    EOF
    

    Error from server (InternalError): error when creating "STDIN": Internal error occurred: failed calling webhook "debug-validation.namespace.sh": failed to call webhook: Post "https://namespace-webhook-service.namespace-system.svc:443/v1/admit?timeout=3s": no endpoints available for service "namespace-webhook-service"

    5)And finally do clean up by using the below commands :

    kubectl delete configmap foo
    configmap "foo" deleted
    
    kubectl -n config-management-system scale deployment config-management-operator --replicas=1
    deployment.apps/config-management-operator scaled