GoogleContainerTools/skaffold · error
failed to deploy: %w
Error message
failed to deploy: %w
What it means
This error wraps any failure from the deploy phase of `skaffold run`. After builds and rendering succeed, r.DeployAndLog applies the manifests to the Kubernetes cluster; any deploy error (kubectl/helm failure, cluster unreachable) is wrapped here.
Source
Thrown at cmd/skaffold/app/cmd/run.go:69
if !opts.SkipTests {
err = r.Test(ctx, out, bRes)
if err != nil {
return fmt.Errorf("failed to test: %w", err)
}
}
// Render
manifestList, err := r.Render(ctx, out, bRes, false)
if err != nil {
return fmt.Errorf("rendering manifests: %w", err)
}
if opts.RenderOnly {
return manifest.Write(manifestList.String(), opts.RenderOutput, out)
}
err = r.DeployAndLog(ctx, out, bRes, manifestList)
if err != nil {
return fmt.Errorf("failed to deploy: %w", err)
}
tips.PrintForRun(out, opts)
return nil
})
}
View on GitHub (pinned to a1189de023)
Solutions
- Read the wrapped cause after 'failed to deploy:' for the kubectl/helm error
- Verify cluster connectivity: kubectl cluster-info and kubectl config current-context
- Run `skaffold deploy` (after a successful build) to isolate the deploy step
- Fix the underlying cause: correct kubecontext, create missing namespaces, or fix rejected manifests
Example fix
// before kubectl config use-context prod-cluster // cluster unreachable // after kubectl config use-context dev-cluster && skaffold run
Defensive patterns
Strategy: try-catch
Validate before calling
kubectl cluster-info --context $(kubectl config current-context) >/dev/null && echo 'cluster reachable'
Try / catch
err := r.DeployAndLog(ctx, out, bRes, manifestList)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
// retry or increase timeout
}
return fmt.Errorf("failed to deploy: %w", err)
} Prevention
- Verify kubecontext and cluster reachability before running skaffold run
- Pre-validate manifests with `kubectl apply --dry-run=server`
- Use --default-repo and correct registry credentials to avoid pull errors
- Isolate deploy issues by running `skaffold deploy` separately
When it happens
Trigger: Running `skaffold run` when DeployAndLog fails: kubectl apply errors, cluster connection refused, namespace missing, image pull failures, or helm deploy failures.
Common situations: kubectl context points to a nonexistent cluster; RBAC denies apply; invalid manifest rejected by API server; wrong kubeconfig in CI.
Related errors
- exiting dev mode because first deploy failed: %w
- watching files for deployer: %w
- getting cluster: %w
- c.Message (pod status condition message)
- unable to lookup minikube executable. Please add it to PATH
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/fd1e21fdbde4bfbc.
Report an issue: GitHub.