GoogleContainerTools / GoogleContainerTools/skaffold
`skaffold dev` fails to deploy when a remote `kubeContext` is set in the skaffold config, but the current context is set to a local cluster
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
Using this modified `skaffold.yaml` from the `/examples/getting-started` project:
```yaml
apiVersion: skaffold/v2beta18
kind: Config
build:
artifacts:
- image: skaffold-example
deploy:
kubeContext: gke_gaghosh-project-1_us-central1-c_fc1
kubectl:
manifests:
- k8s-*
```
with my current kubecontext set to a local `kind` cluster.
### Expected behavior
`skaffold dev` builds the image, pushes it to the remote registry and then deploys to the remote cluster `gke_gaghosh-project-1_us-central1-c_fc1
` specified in the `skaffold.yaml` file.
### Actual behavior
```
❯ skaffold dev
Listing files to watch...
- skaffold-example
Generating tags...
- skaffold-example -> skaffold-example:v1.26.0-41-gc326595dd-dirty
Checking cache...
- skaffold-example: Found. Tagging
Starting test...
Tags used in deployment:
- skaffold-example -> skaffold-example:a9216dc058bacea3d905f96574b2247114fd08f32dadf8e412f270d302e00de0
Starting deploy...
- pod/getting-started created
Waiting for deployments to stabilize...
Deployments stabilized in 1.102 second
Press Ctrl+C to exit
Watching for changes...
rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/skaffold-example:a9216dc058bacea3d905f96574b2247114fd08f32dadf8e412f270d302e00de0": failed to resolve reference "docker.io/library/skaffold-example:a9216dc058bacea3d905f96574b2247114fd08f32dadf8e412f270d302e00de0": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
```
### Information
If the `build.push` setting is not specified then skaffold tries to guess if it should push the built images based on the locally set kubecontext (or that provided by `--kubecontext` flag), even though the deploy definition in the skaffold config can specify a remote cluster.
Contributor guide
Assessment
This issue has not been assessed yet.