Bug description
kn quickstart kind --registry fails intermittently during Kourier installation:
🕸️ Installing Kourier networking layer v1.22.0 ...
error: no matching resources found
Error: failed to install kourier to kind cluster knative: kourier: exit status 1
Root cause
The waitForPodsReady function in pkg/install/install.go uses kubectl wait which fails immediately when no pods match the selector — even with --timeout set:
func waitForPodsReady(ns string) error {
return runCommand(exec.Command("kubectl", "wait", "pod",
"--timeout=10m", "--for=condition=Ready",
"-l", "!job-name", "-n", ns))
}
kubectl wait only waits for existing resources to meet a condition. When no pods exist yet (deployment controller still reconciling), it exits immediately with exit code 1.
Sequence
retryingApply applies kourier.yaml → deployments created
waitForPodsReady("kourier-system") called immediately
3scale-kourier-gateway pod hasn't been created yet
kubectl wait exits instantly: error: no matching resources found
- Installation fails
Reproducibility
This is a race condition — reproduces when pod creation is slower than code execution. Confirmed with:
kubectl wait pod --timeout=5s --for=condition=Ready -l '!job-name' -n kourier-system
# error: no matching resources found (exit 1)
Environment
- kn-quickstart: v1.22.0
- Kind: 0.32.0
- Kubernetes: v1.36.1 (kindest/node:v1.36.1)
- kubectl: v1.36.2
- OS: macOS
Suggested fix
Add a retry loop to waitForPodsReady that handles the "no matching resources found" case:
func waitForPodsReady(ns string) error {
cmd := exec.Command("kubectl", "wait", "pod",
"--timeout=10m", "--for=condition=Ready",
"-l", "!job-name", "-n", ns)
for i := 0; i < 6; i++ {
if err := runCommand(cmd); err == nil {
return nil
}
time.Sleep(10 * time.Second)
}
return fmt.Errorf("timeout waiting for pods in %s", ns)
}
Or alternatively, use kubectl wait --for=condition=Available deployment/<name> first, which properly handles the deployment lifecycle.
Note
The same latent bug exists in the waitForPodsReady("knative-serving") call in Kourier() and all three calls in Eventing(), but those are less likely to trigger because pods in those namespaces are typically already created by earlier steps.
Bug description
kn quickstart kind --registryfails intermittently during Kourier installation:Root cause
The
waitForPodsReadyfunction inpkg/install/install.gouseskubectl waitwhich fails immediately when no pods match the selector — even with--timeoutset:kubectl waitonly waits for existing resources to meet a condition. When no pods exist yet (deployment controller still reconciling), it exits immediately with exit code 1.Sequence
retryingApplyapplieskourier.yaml→ deployments createdwaitForPodsReady("kourier-system")called immediately3scale-kourier-gatewaypod hasn't been created yetkubectl waitexits instantly:error: no matching resources foundReproducibility
This is a race condition — reproduces when pod creation is slower than code execution. Confirmed with:
Environment
Suggested fix
Add a retry loop to
waitForPodsReadythat handles the "no matching resources found" case:Or alternatively, use
kubectl wait --for=condition=Available deployment/<name>first, which properly handles the deployment lifecycle.Note
The same latent bug exists in the
waitForPodsReady("knative-serving")call inKourier()and all three calls inEventing(), but those are less likely to trigger because pods in those namespaces are typically already created by earlier steps.