skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

kubectl deployer defaultNamespace is determined based on current context.

Open yoonsio opened this issue 7 months ago • 1 comments

The kubectl deployer's defaultNamespace is determined by the current context's namespace. This behavior only allows applying raw YAML Kubernetes resources with multiple namespaces if the current context’s namespace is set to default.

This is unexpected behavior, as the current context's namespace should not affect deploying Kubernetes resources across multiple namespaces. The namespace of the resources should be independent of the current context’s namespace.

Relevant code: https://github.com/GoogleContainerTools/skaffold/blame/b212650a1f0f179aca19b7829332904fe1cb284c/pkg/skaffold/deploy/kubectl/kubectl.go#L93

yoonsio avatar Apr 08 '25 18:04 yoonsio

Not sure if it is related, but the latest v2.16.0 does not respect --kube-context switch at all and always try to deploy to the current context. For example, my current context is docker-desktop, but I want to deploy to orbstack with:

skaffold dev -p firehose-listener -f skaffold.yaml -v debug --kube-context=orbstack

However, all resources are still deployed to docker-desktop.

demisx avatar May 24 '25 01:05 demisx