GoogleContainerTools/skaffold · error
initializing pod watcher: %s
Error message
initializing pod watcher: %s
What it means
WaitForPodSucceeded sets up a pod watcher via newPodsWatcher before waiting for the pod to reach Succeeded. If creating that watcher (a List+Watch against the pods API) fails, the error is wrapped as 'initializing pod watcher: %s'. It almost always reflects a Kubernetes API connectivity, auth, or namespace problem, not anything about the pod itself.
Source
Thrown at pkg/skaffold/kubernetes/wait.go:68
case event := <-w.ResultChan():
done, err := condition(&event)
if err != nil {
return err
}
if done {
return nil
}
}
}
}
// WaitForPodSucceeded waits until the Pod status is Succeeded.
func WaitForPodSucceeded(ctx context.Context, pods corev1.PodInterface, podName string, timeout time.Duration) error {
log.Entry(ctx).Infof("Waiting for %s to be complete", podName)
w, err := newPodsWatcher(ctx, pods)
if err != nil {
return fmt.Errorf("initializing pod watcher: %s", err)
}
defer w.Stop()
return watchUntilTimeout(ctx, timeout, w, isPodSucceeded(podName))
}
func isPodSucceeded(podName string) func(event *watch.Event) (bool, error) {
return func(event *watch.Event) (bool, error) {
if event.Object == nil {
return false, nil
}
pod, isPod := event.Object.(*v1.Pod)
if !isPod {
return false, nil
}
if pod.Name != podName {
return false, nil
}View on GitHub (pinned to a1189de023)
Solutions
- Verify cluster connectivity: `kubectl --context <ctx> get pods -n <ns>` with the same context skaffold uses
- Check/refresh credentials (`kubectl auth whoami`, re-login to your cloud provider, update kubeconfig tokens)
- Confirm the namespace exists and is spelled correctly
- Check network/VPN to the API server, then retry the wait
Defensive patterns
Strategy: retry
Validate before calling
// verify API access with the same client config before waiting
_, err := pods.List(ctx, metav1.ListOptions{})
if err != nil {
return fmt.Errorf("cannot access pods API, watcher init would fail: %w", err)
} Try / catch
err := kubernetes.WaitForPodSucceeded(ctx, pods, podName, timeout)
if err != nil {
if apierrors.IsUnauthorized(err) || apierrors.IsForbidden(err) || isConnErr(err) {
if rerr := refreshCredentials(ctx); rerr == nil {
err = kubernetes.WaitForPodSucceeded(ctx, pods, podName, timeout)
}
}
}
return err Prevention
- Validate the kube-context with `kubectl get pods -n <ns>` before long waits
- Keep tokens refreshed for OIDC/cloud auth setups
- Confirm the namespace exists before watching pods in it
- Check VPN/network connectivity in remote-cluster scenarios
When it happens
Trigger: Calling WaitForPodSucceeded with a corev1.PodInterface whose underlying client cannot reach the API server: invalid kubecontext, expired token, network failure, or nonexistent namespace cause the initial List/Watch to error.
Common situations: Wrong kubeconfig / KUBECONFIG pointing at a dead cluster; OIDC token expired; VPN disconnected; namespace typo so the List call returns NotFound.
Related errors
- unknown phase: %s
- initializing deployment watcher: %s
- initializing pod watcher for %q: %w
- attempting to watch verify job in cluster
- attempting to watch verify pods in cluster
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/1dc65df0a40947f3.
Report an issue: GitHub.