GoogleContainerTools / GoogleContainerTools/skaffold
Recommended work-around for the need for local docker for cluster builds
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
In running a `cluster` profile build the first time, kaniko correctly builds the image and the project is deployed.
When running `skaffold dev` or `skaffold run` a second time, skaffold finds the cached image, but, due to a config parameter, it uses some other mechanism to tag the cached image (like telling kaniko to do it?) instead of attempting to do it with the local docker client that has been authenticated to the remote registry.
Basically, it would be nice to use the traditional skaffold in-cluster workflow on a workspace that doesn't have docker.
At the worst case, it would be nice if skaffold used the docker credentials in the `cluster.dockerConfig.path` to authenticate to the remote registry. But it seems to ignore these for the tagging step if there is a cached image.
I am hoping there is some magic combination of parameters to execute in this way.
### Actual behavior
The first run succeeds, however, subsequent runs fail because it is not authenticated to the remote registry.
```
λ skaffold dev
Listing files to watch...
- rubik-1f0b
Generating tags...
- rubik-1f0b -> ml1-harbor.svc.ml1.myprivateregistry.com/library/rubik-1f0b:20200319-121516
Checking cache...
- rubik-1f0b: Found. Tagging
FATA[0005] exiting dev mode because first build failed: tagging image: PUT https://ml1-harbor.svc.ml1.myprivateregistry.com/v2/library/rubik-1f0b/manifests/20200319-121516: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/rubik-1f0b Type:repository] map[Action:push Class: Name:library/rubik-1f0b Type:repository]]
```
I'm assuming that this is the intended behavior, after looking at : https://github.com/GoogleContainerTools/skaffold/issues/2840#issuecomment-543175867
### Information
- Skaffold version: 1.5
- Operating system: Arch Linux
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v1
build:
artifacts:
- image: rubik-1f0b
kaniko:
cache: {}
sync:
manual:
- dest: /app
src: src/**/*.py
strip: src/
- dest: /app
src: src/static/**
strip: src/
tagPolicy:
dateTime:
format: 20060102-150405
deploy:
kubectl:
manifests:
- k8s/*
kind: Config
metadata:
name: rubik-1f0b-
profiles:
- build:
cluster:
dockerConfig:
path: .hub/dockerconfig.json
secretName: rubik-1f0b-dockerconfig
name: incluster
```
### Steps to reproduce the behavior
1. Find your favorite private registry and deployable project.
2. Delete the entry in ~/.docker/config.json for said registry
3. `skaffold run` twice
Contributor guide
Assessment
This issue has not been assessed yet.