GoogleContainerTools/skaffold · error
profiles %q were activated by kube-context %q, but the effec
Error message
profiles %q were activated by kube-context %q, but the effective kube-context is %q -- please revise your `profiles.activation` and `deploy.kubeContext` configurations
What it means
Skaffold profiles can be auto-activated by kube-context (`profiles.activation.kubeContext`). After applying profiles, `checkKubeContextConsistency` (pkg/skaffold/schema/profiles.go:87) verifies that profiles which were activated by the *current* kube-context are consistent with the *effective* kube-context (`deploy.kubeContext`). If they diverge, activating those context-specific profiles would silently target the wrong cluster, so Skaffold fails fast with this message naming the activated profiles and both contexts.
Source
Thrown at pkg/skaffold/schema/profiles.go:87
func checkKubeContextConsistency(contextSpecificProfiles []string, cliContext, effectiveContext string) error {
// cli flag takes precedence
if cliContext != "" {
return nil
}
kubeConfig, err := kubectx.CurrentConfig()
if err != nil {
return fmt.Errorf("getting current cluster context: %w", err)
}
currentContext := kubeConfig.CurrentContext
// nothing to do
if effectiveContext == "" || effectiveContext == currentContext || len(contextSpecificProfiles) == 0 {
return nil
}
return fmt.Errorf("profiles %q were activated by kube-context %q, but the effective kube-context is %q -- please revise your `profiles.activation` and `deploy.kubeContext` configurations", contextSpecificProfiles, currentContext, effectiveContext)
}
// activatedProfiles returns the activated profiles and activated profiles which are kube-context specific.
// The latter matters for error reporting when the effective kube-context changes.
func activatedProfiles(profiles []latest.Profile, opts cfg.SkaffoldOptions, namedProfiles []string) ([]string, []string, error) {
var activated []string
var contextSpecificProfiles []string
if opts.ProfileAutoActivation {
// Auto-activated profiles
for _, profile := range profiles {
isActivated, isCtxSpecific, err := isProfileActivated(profile, opts)
if err != nil {
return nil, nil, err
}
if isActivated {
if isCtxSpecific {View on GitHub (pinned to a1189de023)
Solutions
- Pass the CLI flag `--kube-context <context>` equal to the context that should be used — the CLI flag bypasses this consistency check entirely
- Align `deploy.kubeContext` in skaffold.yaml with the kube-context that triggers the activation (or remove `deploy.kubeContext` so the current-context is used)
- Change the profile's `activation.kubeContext` value to match the effective `deploy.kubeContext`, or remove the kube-context activation condition
- Run `kubectl config current-context` and make sure your kubeconfig current-context matches `deploy.kubeContext` before running skaffold
Example fix
# before
profiles:
- name: staging
activation:
- kubeContext: minikube
deploy:
kubeContext: gke_proj_us-central1
# after
profiles:
- name: staging
activation:
- kubeContext: gke_proj_us-central1
deploy:
kubeContext: gke_proj_us-central1 Defensive patterns
Strategy: validation
Validate before calling
ctx=$(kubectl config current-context); eff=$(yq '.deploy.kubeContext // ""' skaffold.yaml); if [ -n "$eff" ] && [ "$eff" != "$ctx" ]; then echo "use --kube-context or fix deploy.kubeContext"; fi
Prevention
- Keep deploy.kubeContext consistent with activation.kubeContext
- Pass --kube-context in CI to bypass current-context checks
- Run kubectl config current-context before skaffold runs
When it happens
Trigger: Running skaffold (dev/run/deploy/etc.) when: (1) a profile was auto-activated because its `activation.kubeContext` matches the kubectl current-context (e.g. `minikube`), and (2) no `--kube-context` CLI flag was passed (the CLI flag short-circuits the check), and (3) `deploy.kubeContext` in skaffold.yaml is set to a different context than the current one. Called from ApplyProfiles at the end of profile merging.
Common situations: A developer on `minikube` has a profile that activates on `minikube`, but skaffold.yaml also pins `deploy.kubeContext: gke_my-project`; switching kubeconfig's current-context (e.g. after `kubectx`) while leaving `deploy.kubeContext` stale; teams sharing skaffold.yaml where one member's cluster is named differently; CI machines where kubectl current-context differs from the deploy target.
Related errors
- action %v not found for k8s execution mode
- getting k8s configuration: %w
- unable to get kubernetes config: %w
- unable to get current kubernetes context: %w
- STATUSCHECK_CUSTOM_RESOURCE_FETCH_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/9da3564951016caa.
Report an issue: GitHub.