GoogleContainerTools/skaffold · error
skaffold apply called with both Cloud Run and Kubernetes dep
Error message
skaffold apply called with both Cloud Run and Kubernetes deployers. Mixing deployment targets is not allowed when using the Cloud Run deployer
What it means
When constructing the deployer for `skaffold apply`, GetDeployer rejects configs that mix the Cloud Run deployer with Kubernetes deployers (any non-helm deployer or helm releases with namespaces), because Cloud Run deploys cannot be combined with other deployment targets. The error is returned before any deployment starts.
Source
Thrown at pkg/skaffold/runner/deployer.go:120
nonHelmDeployFound = true
}
if d.CloudRunDeploy != nil {
cloudRunDeployFound = true
}
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
}
}
}
View on GitHub (pinned to a1189de023)
Solutions
- Split the config so Cloud Run and Kubernetes deployers live in separate skaffold projects and run `skaffold apply` for each separately
- Use profiles to select exactly one deployer per apply invocation and pass the intended -p flag
- Remove the unwanted deployer section (cloudrun or k8s/helm) from skaffold.yaml
Example fix
// before
deploy:
cloudrun: {projectid: my-proj}
kubectl: {manifests: [k8s/*.yaml]}
// after
deploy:
kubectl: {manifests: [k8s/*.yaml]} # keep only one deployer target per apply
Defensive patterns
Strategy: validation
Validate before calling
hasCloudRun, hasK8s := false, false
for _, d := range cfg.Deploy { /* classify cloudrun vs kubectl/helm/kustomize */ }
if hasCloudRun && hasK8s { return errors.New("skaffold.yaml mixes Cloud Run and Kubernetes deployers; keep one target per project") } Type guard
func isCloudRunOnly(d latest.DeployConfig) bool { return d.CloudRunDeploy != nil && d.KubectlDeploy == nil && d.HelmDeploy == nil && d.KustomizeDeploy == nil } Try / catch
deployer, err := runner.GetDeployer(ctx, runCtx, labeller, cfg)
if err != nil && strings.Contains(err.Error(), "Mixing deployment targets") {
return fmt.Errorf("split cloudrun and k8s configs into separate projects: %w", err)
} Prevention
- Keep Cloud Run and Kubernetes deployments in separate skaffold projects
- Review profile merges for accidental deployer sections
- Audit skaffold.yaml deploy sections after migrations
When it happens
Trigger: skaffold.yaml (possibly merged across profiles/required configs) contains both a `cloudrun` deploy entry and a k8s/helm deploy entry, and `skaffold apply` is run.
Common situations: Teams adding Cloud Run to an existing k8s skaffold.yaml; profile merging pulling in a cloudrun deployer alongside kubectl/helm deployers; copy-pasted deploy sections.
Related errors
- docker deployment not supported alongside cluster deployment
- INIT_CLOUD_RUN_LOCATION_ERROR
- expected all Cloud Run deploys to be in the same region, fou
- `apply` requires at least one manifest argument
- `exec` requires exactly one action to execute
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/4449f57743a6bd02.
Report an issue: GitHub.