GoogleContainerTools/skaffold · error
skaffold apply called with conflicting namespaces set via sk
Error message
skaffold apply called with conflicting namespaces set via skaffold.yaml. This is likely due to the use of the 'deploy.helm.releases.*.namespace' field which is not supported in apply. Remove the 'deploy.helm.releases.*.namespace' field(s) and run skaffold apply again
What it means
GetDeployer validates helm release namespaces for `skaffold apply`, which does not support the deploy.helm.releases.*.namespace field. If more than one helm namespace is set, or a non-helm deployer is combined with exactly one helm namespace, the resulting conflicting/unsupported namespace configuration aborts with this error.
Source
Thrown at pkg/skaffold/runner/deployer.go:126
if d.LegacyHelmDeploy != nil {
for _, release := range d.LegacyHelmDeploy.Releases {
if release.Namespace != "" {
helmNamespaces[release.Namespace] = true
}
}
}
}
if cloudRunDeployFound {
if nonHelmDeployFound || len(helmNamespaces) > 0 {
// Cloud Run doesn't support multiple deployers in the config.
return nil, errors.New("skaffold apply called with both Cloud Run and Kubernetes deployers. Mixing deployment targets is not allowed" +
" when using the Cloud Run deployer")
}
return getCloudRunDeployer(runCtx, labeller, pipelines.Deployers(), "")
}
if len(helmNamespaces) > 1 || (nonHelmDeployFound && len(helmNamespaces) == 1) {
return nil, errors.New("skaffold apply called with conflicting namespaces set via skaffold.yaml. This is likely due to the use of the 'deploy.helm.releases.*.namespace' field which is not supported in apply. Remove the 'deploy.helm.releases.*.namespace' field(s) and run skaffold apply again")
}
if len(helmNamespaces) == 1 && !nonHelmDeployFound {
if runCtx.Opts.Namespace == "" {
// if skaffold --namespace flag not set, use the helm namespace value
for k := range helmNamespaces {
// map only has 1 (k,v) from length check in if condition
runCtx.Opts.Namespace = k
}
}
}
return getDefaultDeployer(runCtx, labeller, gks)
}
var deployers []deploy.Deployer
localDeploy := false
remoteDeploy := falseView on GitHub (pinned to a1189de023)
Solutions
- Remove the `deploy.helm.releases.*.namespace` fields from skaffold.yaml and re-run `skaffold apply`
- Set the target namespace globally with the `--namespace` flag instead of per-release namespace fields
- Split releases targeting different namespaces into separate skaffold projects/invocations
Example fix
// before
releases:
- name: a
chartPath: chart-a
namespace: ns-a
- name: b
chartPath: chart-b
namespace: ns-b
// after
releases:
- name: a
chartPath: chart-a
- name: b
chartPath: chart-b
# then: skaffold apply --namespace ns-a Defensive patterns
Strategy: validation
Validate before calling
namespaces := map[string]bool{}
for _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != "" { namespaces[r.Namespace] = true } }
if len(namespaces) > 1 { return errors.New("apply does not support multiple helm release namespaces; use --namespace and remove release namespaces") } Type guard
func helmReleasesHaveNamespace(cfg *latest.SkaffoldConfig) bool {
for _, r := range cfg.Deploy.Helm.Releases { if r.Namespace != "" { return true } }
return false
} Try / catch
deployer, err := runner.GetDeployer(ctx, runCtx, labeller, cfg)
if err != nil && strings.Contains(err.Error(), "deploy.helm.releases.*.namespace") {
return fmt.Errorf("strip per-release namespaces for apply: %w", err)
} Prevention
- Avoid deploy.helm.releases.*.namespace when using `skaffold apply`; use --namespace flag instead
- Deploy releases to different namespaces via separate invocations
- Diff configs after migrating between skaffold run and apply
When it happens
Trigger: skaffold.yaml has helm releases with two different `namespace` values, or a kubectl/kustomize deployer plus one helm release that sets `namespace`, followed by `skaffold apply`.
Common situations: Configs migrated from `skaffold run` (where helm namespace works) to `skaffold apply`; multiple releases intentionally deployed to different namespaces; mixed kubectl+helm pipelines.
Related errors
- Failed to render release
- `apply` requires at least one manifest argument
- `exec` requires exactly one action to execute
- `config-dependencies add` requires exactly one file path arg
- `jobManifestPaths modify` requires exactly one manifest file
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/c8ce0bceceec38c4.
Report an issue: GitHub.