Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skaffold dev stopped loading built images into local kind cluster since 1.17.1 #5159

Closed
taisph opened this issue Dec 16, 2020 · 25 comments
Closed
Assignees
Labels
area/deploy kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.

Comments

@taisph
Copy link

taisph commented Dec 16, 2020

Expected behavior

skaffold dev loads built images into local kind cluster before deploying.

Using skaffold 1.17.0:

Listing files to watch...
 - project-service-app
Generating tags...
 - project-service-app -> project-service-app:dev-debug
Checking cache...
 - project-service-app: Found Locally
Tags used in deployment:
 - project-service-app -> project-service-app:065ff409365c9f9b13fc00c6e88c835a11e4d0c4c712e682e33f40fc4072c77c
Loading images into kind cluster nodes...
 - project-service-app:065ff409365c9f9b13fc00c6e88c835a11e4d0c4c712e682e33f40fc4072c77c -> Found
Images loaded in 265.108518ms
Starting deploy...

Actual behavior

skaffold dev skips the load.

Using skaffold 1.17.2:

Listing files to watch...
 - project-service-app
Generating tags...
 - project-service-app -> project-service-app:dev-debug
Checking cache...
 - project-service-app: Found Locally
Tags used in deployment:
 - project-service-app -> project-service-app:065ff409365c9f9b13fc00c6e88c835a11e4d0c4c712e682e33f40fc4072c77c
Starting deploy...

Information

  • Skaffold version: 1.17.1 and 1.17.2
  • Operating system: Ubuntu 20.04.1 LTS
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta10
kind: Config
build:
  artifacts:
  - image: project-service-app
    context: .
    docker:
      dockerfile: build/service-app/Dockerfile
      buildArgs:
        BUILD_BRANCH_NAME: '{{if (index . "BUILD_BRANCH_NAME")}}{{.BUILD_BRANCH_NAME}}{{end}}'
        BUILD_ID: '{{if (index . "BUILD_ID")}}{{.BUILD_ID}}{{end}}'
        BUILD_REVISION_ID: '{{if (index . "BUILD_REVISION_ID")}}{{.BUILD_REVISION_ID}}{{end}}'
        BUILD_VARIANT: '{{if (index . "BUILD_VARIANT")}}{{.BUILD_VARIANT}}{{else}}debug{{end}}'
        BUILD_VERSION: '{{if (index . "BUILD_VERSION")}}{{.BUILD_VERSION}}{{end}}'
  tagPolicy:
    envTemplate:
      template: '{{if (index . "BUILD_TAG_NAME")}}{{.BUILD_TAG_NAME}}{{else if (index
        . "BUILD_SHORT_SHA")}}{{.BUILD_SHORT_SHA}}{{else}}dev{{end}}-{{if (index .
        "BUILD_VARIANT")}}{{.BUILD_VARIANT}}{{else}}debug{{end}}'
  local:
    push: false
deploy:
  kustomize:
    paths:
    - deployments/service
  statusCheckDeadlineSeconds: 300
  kubeContext: kind-project
profiles:
- name: cicd
  build:
    local:
      push: true
  deploy:
    kustomize:
      paths:
      - deployments/service
    kubeContext: kind-project

Tested with empty skaffold config and kind-disable-load explicitly set to false.

@briandealwis
Copy link
Member

Hi @taisph — could you please rerun with -vdebug to produce debugging logs?

@briandealwis briandealwis added area/deploy kind/bug Something isn't working needs-reproduction needs reproduction from the maintainers to validate the issue is truly a skaffold bug labels Dec 16, 2020
@briandealwis
Copy link
Member

And could you please include your ~/.skaffold/config too?

@briandealwis
Copy link
Member

Using your skaffold.yaml on 1.17.2, I see:

$ skaffold dev -vdebug
[...]
Tags used in deployment:
 - project-service-app -> project-service-app:16bb174b9a147d3f574fb5fe967b7f5c873a0150182dbb0f72d1fb2fffd69a12
DEBU[0000] Local images can't be referenced by digest.
They are tagged and referenced by a unique, local only, tag instead.
See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works 
DEBU[0000] getting client config for kubeContext: `kind-project` 
DEBU[0000] could not parse date ""                      
Loading images into kind cluster nodes...
 - project-service-app:16bb174b9a147d3f574fb5fe967b7f5c873a0150182dbb0f72d1fb2fffd69a12 -> DEBU[0000] Running command: [kubectl --context kind-project get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'] 
DEBU[0000] Command output: ['k8s.gcr.io/etcd:3.4.13-0 k8s.gcr.io/kube-proxy:v1.19.1 docker.io/kindest/kindnetd:v20200725-4d6bea59 k8s.gcr.io/kube-apiserver:v1.19.1 k8s.gcr.io/kube-controller-manager:v1.19.1 k8s.gcr.io/kube-scheduler:v1.19.1 k8s.gcr.io/build-image/debian-base:v2.1.0 k8s.gcr.io/coredns:1.7.0 docker.io/rancher/local-path-provisioner:v0.0.14 docker.io/library/project-service-app:16bb174b9a147d3f574fb5fe967b7f5c873a0150182dbb0f72d1fb2fffd69a12 k8s.gcr.io/pause:3.3'] 
Found
Images loaded in 79.888654ms
Starting deploy...
[...]

The other thing to check: what version of kind do you have installed? I'm running:

$ kind version
kind v0.9.0 go1.15.2 darwin/amd64

@taisph
Copy link
Author

taisph commented Dec 21, 2020

$ skaffold dev -vdebug
[...]
Tags used in deployment:
 - project-service-app -> project-service-app:cab7ba6bef78752bd4a887d1930a1da1b2811d5e50eb8c7aa7397bfd07ffba5a
DEBU[0060] Local images can't be referenced by digest.
They are tagged and referenced by a unique, local only, tag instead.
See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works
DEBU[0060] getting client config for kubeContext: `kind-project`
Starting deploy...
[...]
$ cat ~/.skaffold/config
global:
  survey:
    last-prompted: "2020-10-29T14:50:03+01:00"
kubeContexts: []
$ kind version
kind v0.9.0 go1.14.7 linux/amd64
$ skaffold version
v1.17.2

@taisph
Copy link
Author

taisph commented Dec 21, 2020

Seems like the kubectl current context must match the context specified in deploy.kubeContext in the skaffold config since 1.17.1. If kubectl context is different, images are not loaded.

@briandealwis
Copy link
Member

That sounds like you're hitting #4428.

@briandealwis
Copy link
Member

Could you include your full debug logs please @taisph? Does it make a difference if you remove the kubeContext?

@gsquared94 gsquared94 added the priority/p1 High impact feature/bug. label Jan 27, 2021
@taisph
Copy link
Author

taisph commented Jan 28, 2021

Could you include your full debug logs please @taisph? Does it make a difference if you remove the kubeContext?

There's a lot of potentially sensitive information in those debug logs so I'll have to figure out how to anonymize them first before adding it here in full.

Removing the kubeContext setting would make it deploy on any active context, unless I misunderstood the question. That's the exact opposite of what I want to happen.

Anyway, I just discovered that if I keep running skaffold dev it will at some point trigger the load. Most times it skips the "Loading images into kind cluster nodes..." step but every now and then it will do it. Even if it already exists in the cluster.

I've added log excerpts below that was created by a cycle of adding a space to a string in the code to ensure a fresh build (except for the cached one) and then running skaffold dev -vdebug in the same terminal. Nothing else was touched or changed between each run. Kubectl current-context was set to "gke_something" during all the runs.

The line below seems to appear in all the runs that does not load the image.

time="2021-01-28T10:25:45+01:00" level=debug msg="found config for context \"gke_something\""

Run with fresh build that didn't load into cluster:

time="2021-01-28T10:25:45+01:00" level=info msg="starting gRPC server on port 50051"
time="2021-01-28T10:25:45+01:00" level=info msg="starting gRPC HTTP server on port 50052"
time="2021-01-28T10:25:45+01:00" level=info msg="Skaffold &{Version:v1.17.2 ConfigVersion:skaffold/v2beta10 GitVersion: GitCommit:53e4063e12b41bc19c6cd3929d939f17ad2e88de GitTreeState:clean BuildDate:2020-12-09T06:20:30Z GoVersion:go1.14.2 Compiler:gc Platform:linux/amd64}"
time="2021-01-28T10:25:45+01:00" level=info msg="Loaded Skaffold defaults from \"/home/user/.skaffold/config\""
time="2021-01-28T10:25:45+01:00" level=debug msg="found config for context \"gke_something\""
time="2021-01-28T10:25:45+01:00" level=info msg="Activated kube-context \"kind-project\""
time="2021-01-28T10:25:45+01:00" level=info msg="Using kubectl context: kind-project"
time="2021-01-28T10:25:45+01:00" level=debug msg="Using builder: local"
time="2021-01-28T10:25:45+01:00" level=debug msg="Running command: [/home/user/Development/google-cloud-sdk/bin/minikube profile list -o json]"
time="2021-01-28T10:25:45+01:00" level=debug msg="could not parse date \"\""
time="2021-01-28T10:25:45+01:00" level=debug msg="Command output: [
[...]
Successfully built ef2f65346bd1
Successfully tagged project-service-a:dev-debug
time="2021-01-28T10:26:20+01:00" level=info msg="Build complete in 34.833409051s"
time="2021-01-28T10:26:20+01:00" level=info msg="Test complete in 449ns"
Tags used in deployment:
 - project-service-a -> project-service-a:ef2f65346bd1c2c943270123cfdc6a08132cfb6e1a791a122bdc8affc30b56c5
time="2021-01-28T10:26:20+01:00" level=debug msg="Local images can't be referenced by digest.\nThey are tagged and referenced by a unique, local only, tag instead.\nSee https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works"
time="2021-01-28T10:26:20+01:00" level=debug msg="getting client config for kubeContext: `kind-project`"
Starting deploy...
time="2021-01-28T10:26:20+01:00" level=debug msg="Running command: [kubectl version --client -ojson]"
time="2021-01-28T10:26:20+01:00" level=debug msg="Command output: [{\n  \"clientVersion\": {\n    \"major\": \"1\",\n    \"minor\": \"17+\",\n    \"gitVersion\": \"v1.17.14-dispatcher\",\n    \"gitCommit\": \"766e62361387c284022a97270f0997d67ae792d0\",\n    \"gitTreeState\": \"clean\",\n    \"buildDate\": \"2020-12-01T16:13:56Z\",\n    \"goVersion\": \"go1.13.9\",\n    \"compiler\": \"gc\",\n    \"platform\": \"linux/amd64\"\n  }\n}\n]"
time="2021-01-28T10:26:20+01:00" level=debug msg="Running command: [kustomize build deployments/service_a]"

Run with fresh build that did load:

time="2021-01-28T10:47:11+01:00" level=info msg="starting gRPC server on port 50051"
time="2021-01-28T10:47:11+01:00" level=info msg="starting gRPC HTTP server on port 50052"
time="2021-01-28T10:47:11+01:00" level=info msg="Skaffold &{Version:v1.17.2 ConfigVersion:skaffold/v2beta10 GitVersion: GitCommit:53e4063e12b41bc19c6cd3929d939f17ad2e88de GitTreeState:clean BuildDate:2020-12-09T06:20:30Z GoVersion:go1.14.2 Compiler:gc Platform:linux/amd64}"
time="2021-01-28T10:47:11+01:00" level=info msg="Loaded Skaffold defaults from \"/home/user/.skaffold/config\""
time="2021-01-28T10:47:11+01:00" level=info msg="Activated kube-context \"kind-project\""
time="2021-01-28T10:47:11+01:00" level=info msg="Using kubectl context: kind-project"
time="2021-01-28T10:47:11+01:00" level=debug msg="Using builder: local"
time="2021-01-28T10:47:11+01:00" level=debug msg="Running command: [/home/user/Development/google-cloud-sdk/bin/minikube profile list -o json]"
time="2021-01-28T10:47:11+01:00" level=debug msg="Command output: [
[...]
Successfully built ed16d09b57a3
Successfully tagged project-service-a:dev-debug
time="2021-01-28T10:47:42+01:00" level=info msg="Build complete in 30.414335162s"
time="2021-01-28T10:47:42+01:00" level=info msg="Test complete in 608ns"
Tags used in deployment:
 - project-service-a -> project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d
time="2021-01-28T10:47:42+01:00" level=debug msg="Local images can't be referenced by digest.\nThey are tagged and referenced by a unique, local only, tag instead.\nSee https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works"
time="2021-01-28T10:47:42+01:00" level=debug msg="getting client config for kubeContext: `kind-project`"
Loading images into kind cluster nodes...
 - project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d -> time="2021-01-28T10:47:42+01:00" level=debug msg="Running command: [kubectl --context kind-project get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}']"
time="2021-01-28T10:47:42+01:00" level=debug msg="Command output: ['quay.io/user/cloud-sdk-pubsub@sha256:31fdb9c0ebd774c9c9ee0cbaaff85c62d008cb7838957abcf097b7f614ca1bcb docker.io/library/project-service-c-app:6cdf58a8d219e80ad7e13cdbc8365478463c545822f1ad864c17160d64c16f61 docker.io/library/project-service-b:e6711c75eafd2a3f9455e496860eb32fc63a700b14deae9caf184874e5b76ea5 k8s.gcr.io/etcd:3.4.13-0 docker.io/library/mongo@sha256:fafd7c6063fd7f67bff7587182c8f5322232eca719c04f4b3da2ffc05ccc85ac docker.io/library/mongo:4.0 k8s.gcr.io/kube-proxy:v1.19.1 docker.io/kindest/kindnetd:v20200725-4d6bea59 k8s.gcr.io/kube-apiserver:v1.19.1 k8s.gcr.io/kube-controller-manager:v1.19.1 docker.io/library/influxdb@sha256:65cb0a80cab9744a2892c9720867fdbd1a61784529c599fd37105893d8a6a6e4 docker.io/library/influxdb:1.8.3-alpine k8s.gcr.io/kube-scheduler:v1.19.1 k8s.gcr.io/build-image/debian-base:v2.1.0 k8s.gcr.io/coredns:1.7.0 docker.io/rancher/local-path-provisioner:v0.0.14 docker.io/library/project-service-a:72e292a0a2e3f9630c36f6146fc3c20405eaf62422c0e1b0319300e8246c1f36 docker.io/library/project-service-a:10ada36fb764bc20645a69eb43ffb72c47a0c800793ae05caab6d4df1b6078df docker.io/library/project-service-a:d67b2a5e3a9899afd710438ed3461abadac74801f912b03a6cfbb6abf76234cf docker.io/library/project-service-a:535a82ab527f0ca660427af3d7c620ac384ba7f853457018dd748f5c415cff6a docker.io/library/redis@sha256:2cd821f730b90a197816252972c2472e3d1fad3c42f052580bc958d3ad641f96 docker.io/library/redis:6.0-alpine docker.io/library/nginx@sha256:7ae8e5c3080f6012f8dc719e2308e60e015fcfa281c3b12bf95614bd8b6911d6 docker.io/library/nginx:1.18-alpine k8s.gcr.io/pause:3.3']"
time="2021-01-28T10:47:42+01:00" level=debug msg="Running command: [kind load docker-image --name project project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d]"
time="2021-01-28T10:47:43+01:00" level=debug msg="Command output: [], stderr: Image: \"project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d\" with ID \"sha256:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d\" not yet present on node \"project-control-plane\", loading...\n"
Loaded
Images loaded in 1.375396199s
Starting deploy...
time="2021-01-28T10:47:43+01:00" level=debug msg="Running command: [kubectl version --client -ojson]"
time="2021-01-28T10:47:43+01:00" level=debug msg="Command output: [{\n  \"clientVersion\": {\n    \"major\": \"1\",\n    \"minor\": \"17+\",\n    \"gitVersion\": \"v1.17.14-dispatcher\",\n    \"gitCommit\": \"766e62361387c284022a97270f0997d67ae792d0\",\n    \"gitTreeState\": \"clean\",\n    \"buildDate\": \"2020-12-01T16:13:56Z\",\n    \"goVersion\": \"go1.13.9\",\n    \"compiler\": \"gc\",\n    \"platform\": \"linux/amd64\"\n  }\n}\n]"
time="2021-01-28T10:47:43+01:00" level=debug msg="Running command: [kustomize build deployments/service_a]"

Run with cached build that did load:

time="2021-01-28T10:58:58+01:00" level=info msg="starting gRPC server on port 50051"
time="2021-01-28T10:58:58+01:00" level=info msg="starting gRPC HTTP server on port 50052"
time="2021-01-28T10:58:58+01:00" level=info msg="Skaffold &{Version:v1.17.2 ConfigVersion:skaffold/v2beta10 GitVersion: GitCommit:53e4063e12b41bc19c6cd3929d939f17ad2e88de GitTreeState:clean BuildDate:2020-12-09T06:20:30Z GoVersion:go1.14.2 Compiler:gc Platform:linux/amd64}"
time="2021-01-28T10:58:58+01:00" level=info msg="Loaded Skaffold defaults from \"/home/user/.skaffold/config\""
time="2021-01-28T10:58:58+01:00" level=info msg="Activated kube-context \"kind-project\""
time="2021-01-28T10:58:58+01:00" level=info msg="Using kubectl context: kind-project"
time="2021-01-28T10:58:58+01:00" level=debug msg="Using builder: local"
time="2021-01-28T10:58:58+01:00" level=debug msg="Running command: [/home/user/Development/google-cloud-sdk/bin/minikube profile list -o json]"
time="2021-01-28T10:58:58+01:00" level=debug msg="could not parse date \"\""
time="2021-01-28T10:58:58+01:00" level=debug msg="Command output: [
[...]
 - project-service-a: Found Locally
time="2021-01-28T10:58:58+01:00" level=info msg="Cache check complete in 6.81136ms"
time="2021-01-28T10:58:58+01:00" level=info msg="Test complete in 529ns"
Tags used in deployment:
 - project-service-a -> project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d
time="2021-01-28T10:58:58+01:00" level=debug msg="Local images can't be referenced by digest.\nThey are tagged and referenced by a unique, local only, tag instead.\nSee https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works"
time="2021-01-28T10:58:58+01:00" level=debug msg="getting client config for kubeContext: `kind-project`"
Loading images into kind cluster nodes...
 - project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d -> time="2021-01-28T10:58:58+01:00" level=debug msg="Running command: [kubectl --context kind-project get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}']"
time="2021-01-28T10:58:58+01:00" level=debug msg="Command output: ['quay.io/user/cloud-sdk-pubsub@sha256:31fdb9c0ebd774c9c9ee0cbaaff85c62d008cb7838957abcf097b7f614ca1bcb docker.io/library/project-service-c-app:6cdf58a8d219e80ad7e13cdbc8365478463c545822f1ad864c17160d64c16f61 docker.io/library/project-service-b:e6711c75eafd2a3f9455e496860eb32fc63a700b14deae9caf184874e5b76ea5 k8s.gcr.io/etcd:3.4.13-0 docker.io/library/mongo@sha256:fafd7c6063fd7f67bff7587182c8f5322232eca719c04f4b3da2ffc05ccc85ac docker.io/library/mongo:4.0 k8s.gcr.io/kube-proxy:v1.19.1 docker.io/kindest/kindnetd:v20200725-4d6bea59 k8s.gcr.io/kube-apiserver:v1.19.1 k8s.gcr.io/kube-controller-manager:v1.19.1 docker.io/library/influxdb@sha256:65cb0a80cab9744a2892c9720867fdbd1a61784529c599fd37105893d8a6a6e4 docker.io/library/influxdb:1.8.3-alpine k8s.gcr.io/kube-scheduler:v1.19.1 k8s.gcr.io/build-image/debian-base:v2.1.0 k8s.gcr.io/coredns:1.7.0 docker.io/rancher/local-path-provisioner:v0.0.14 docker.io/library/project-service-a:72e292a0a2e3f9630c36f6146fc3c20405eaf62422c0e1b0319300e8246c1f36 docker.io/library/project-service-a:10ada36fb764bc20645a69eb43ffb72c47a0c800793ae05caab6d4df1b6078df docker.io/library/project-service-a:ed16d09b57a3125d9c406381ee95123cd25a8cc1aa6620034eb3f76ee9fd135d docker.io/library/project-service-a:d67b2a5e3a9899afd710438ed3461abadac74801f912b03a6cfbb6abf76234cf docker.io/library/project-service-a:535a82ab527f0ca660427af3d7c620ac384ba7f853457018dd748f5c415cff6a docker.io/library/redis@sha256:2cd821f730b90a197816252972c2472e3d1fad3c42f052580bc958d3ad641f96 docker.io/library/redis:6.0-alpine docker.io/library/nginx@sha256:7ae8e5c3080f6012f8dc719e2308e60e015fcfa281c3b12bf95614bd8b6911d6 docker.io/library/nginx:1.18-alpine k8s.gcr.io/pause:3.3']"
Found
Images loaded in 59.535297ms
Starting deploy...
time="2021-01-28T10:58:58+01:00" level=debug msg="Running command: [kubectl version --client -ojson]"
time="2021-01-28T10:58:58+01:00" level=debug msg="Command output: [{\n  \"clientVersion\": {\n    \"major\": \"1\",\n    \"minor\": \"17+\",\n    \"gitVersion\": \"v1.17.14-dispatcher\",\n    \"gitCommit\": \"766e62361387c284022a97270f0997d67ae792d0\",\n    \"gitTreeState\": \"clean\",\n    \"buildDate\": \"2020-12-01T16:13:56Z\",\n    \"goVersion\": \"go1.13.9\",\n    \"compiler\": \"gc\",\n    \"platform\": \"linux/amd64\"\n  }\n}\n]"
time="2021-01-28T10:58:58+01:00" level=debug msg="Running command: [kustomize build deployments/service_a]"

@taisph
Copy link
Author

taisph commented Feb 23, 2021

Still an issue with skaffold v1.19.0.

@tejal29 tejal29 self-assigned this Feb 26, 2021
@tejal29
Copy link
Member

tejal29 commented Feb 26, 2021

Reproduction notes

  1. kind version & skaffold version
kind version
kind v0.9.0 go1.14.7 linux/amd64
kind v0.10.0 go1.15.3 darwin/amd64


../../skaffold version
v1.20.0

skaffold config:

apiVersion: skaffold/v2beta10
kind: Config
build:
  tagPolicy:
    envTemplate:
      template: '{{if (index . "BUILD_TAG_NAME")}}{{.BUILD_TAG_NAME}}{{else if (index
        . "BUILD_SHORT_SHA")}}{{.BUILD_SHORT_SHA}}{{else}}dev{{end}}-{{if (index .
        "BUILD_VARIANT")}}{{.BUILD_VARIANT}}{{else}}debug{{end}}'
  local:
    push: false
  artifacts:
  - image: skaffold-example
deploy:
  kubeContext: kind-kind
  kubectl:
    manifests:
      - k8s-*
      - 
  1. skaffold example cd skaffold/examples/getting-started
apiVersion: skaffold/v2beta12
kind: Config
build:
  artifacts:
  - image: skaffold-example
deploy:
  kubeContext: kind
  kubectl:
    manifests:
      - k8s-*
  1. running skaffold dev - I see skaffold loading images

Loading images into kind cluster nodes...
 - skaffold-example:72d26b204e1c0657dbd312b2af0a0d1a1e93583342c02bcb07bcb3450066e797 -> Loaded
 

@tejal29
Copy link
Member

tejal29 commented Feb 26, 2021

v1.19.0

@taisph i am not able to reproduce this for v1.20.0.
I will try for skaffold v1.19.0

@tejal29
Copy link
Member

tejal29 commented Feb 26, 2021

ok, i was finally able to reproduce this bug.
Here is the complete skaffold.log https://gist.github.com/tejal29/70492f02e6de2f8b16376f49c933dd0f

➜  getting-started git:(master) ✗ ../../skaffold dev -v=debug  
INFO[0000] starting gRPC server on port 50051           
INFO[0000] starting gRPC HTTP server on port 50052      
INFO[0000] Skaffold &{Version:v1.20.0 ConfigVersion:skaffold/v2beta12 GitVersion: 
....

Successfully tagged skaffold-example:dev-debug
INFO[0063] Build completed in 6.082 seconds             
INFO[0063] Test completed in 463ns                      
Tags used in deployment:
 - skaffold-example -> skaffold-example:9ffb1dab0f0cfe3b9011dc44b47c655429c6d381adfc31b4f1c7afc7715fdd19
DEBU[0063] Local images can't be referenced by digest.
They are tagged and referenced by a unique, local only, tag instead.
See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works 
DEBU[0063] getting client config for kubeContext: `kind-kind` 
Loading images into kind cluster nodes...
 - skaffold-example:9ffb1dab0f0cfe3b9011dc44b47c655429c6d381adfc31b4f1c7afc7715fdd19 -> DEBU[0063] Running command: [kubectl --context kind-kind get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'] 
DEBU[0066] Command output: ['k8s.gcr.io/etcd:3.4.13-0 docker.io/kindest/kindnetd:v20210119-d5ef916d k8s.gcr.io/kube-proxy:v1.20.2 k8s.gcr.io/kube-apiserver:v1.20.2 k8s.gcr.io/kube-controller-manager:v1.20.2 k8s.gcr.io/build-image/debian-base:v2.1.0 k8s.gcr.io/kube-scheduler:v1.20.2 k8s.gcr.io/coredns:1.7.0 docker.io/rancher/local-path-provisioner:v0.0.14 docker.io/library/skaffold-example:eabae482ac3a7d1669933871298636c7bd32c0891603b969c8b7376154042546 docker.io/library/skaffold-example:a4ac60aa40be5710a98b1bc7b7de1471e7dee35cd3ba76b87ae1eb95bfca2820 docker.io/library/skaffold-example:72d26b204e1c0657dbd312b2af0a0d1a1e93583342c02bcb07bcb3450066e797 k8s.gcr.io/pause:3.3'] 
DEBU[0066] Running command: [kind load docker-image --name kind skaffold-example:9ffb1dab0f0cfe3b9011dc44b47c655429c6d381adfc31b4f1c7afc7715fdd19] 
Failed
WARN[0066] Skipping deploy due to error: loading images into kind nodes: unable to load image "skaffold-example:9ffb1dab0f0cfe3b9011dc44b47c655429c6d381adfc31b4f1c7afc7715fdd19" into cluster: starting command kind load docker-image --name kind skaffold-example:9ffb1dab0f0cfe3b9011dc44b47c655429c6d381adfc31b4f1c7afc7715fdd19: exec: "kind": executable file not found in $PATH,  
Watching for changes...


This happens randomly on any dev iteration. Not sure why.

I had previously run skaffold dev on latest v1.20.0 version 3-4 times and never seen this.

@taisph
Copy link
Author

taisph commented Mar 8, 2021

@tejal29 I don't even see the "Loading images into kind cluster nodes..." message here and for me it just skips directly to deployment most of the time when kubectl is pointing at a different context than skaffold is configured to use. As soon as I switch kubectl context to match skaffold, it performs the loading images step seemingly every time.

This goes for skaffold v1.20.0 as well.

I've looked into the code and as far as I can tell, the issue for me is that the Cluster.LoadImages bool (pkg/skaffold/config/util.go) end up false as it is derived from the current kubectl context and not the deployment context given in the skaffold conf. GetRunContext (pkg/skaffold/runner/runcontext/context.go) has the expected context in kubeContext but it is not used for creating the Cluster struct. I suspect #5012 is the culprit.

@tejal29
Copy link
Member

tejal29 commented Apr 5, 2021

@taisph for the feedback.
We do have some errors around --kubeContext flag and deploy context resolution. Here is the associated #4347

@tejal29 tejal29 removed the needs-reproduction needs reproduction from the maintainers to validate the issue is truly a skaffold bug label Apr 7, 2021
@briandealwis briandealwis added priority/p2 May take a couple of releases and removed priority/p1 High impact feature/bug. labels Apr 23, 2021
@gsquared94
Copy link
Collaborator

@taisph can you try with the v1.27.0 or newer release? We made a series of fixes in this area and #4347 was also closed due to it.

@taisph
Copy link
Author

taisph commented Jul 14, 2021

@taisph can you try with the v1.27.0 or newer release? We made a series of fixes in this area and #4347 was also closed due to it.

Still doesn't load images into the kind cluster and now port forwarding seems to have issues as well.

WARN[0001] could not map pods to service default/mongo/27017: getting service default/mongo: services "mongo" not found
WARN[0001] could not map pods to service default/pubsub/8085: getting service default/pubsub: services "pubsub" not found
WARN[0002] could not map pods to service default/mongo/27017: getting service default/mongo: services "mongo" not found
WARN[0002] could not map pods to service default/pubsub/8085: getting service default/pubsub: services "pubsub" not found

Switching the kubectl context back to the local cluster makes skaffold work as expected. Explicitly using --kube-context with skaffold dev also seems to work - something I haven't used before. But having the context set in skaffold.yaml under deploy.kubeContext alone does not.

@wind57
Copy link

wind57 commented Jul 20, 2021

It seems I hit the same exact issue, see here, for example: https://stackoverflow.com/questions/68414470/skaffold-miss-configuration-or-how-to-set-up-a-simple-helm-example

No matter what I do:

  • deploy.kubeContext
  • --kube-context ...

things do not work.

halvards added a commit to halvards/skaffold that referenced this issue Jul 27, 2021
I was able to reproduce the issue locally and work out a fix. I'd be
happy for feedback on whether I've chosen the right place to fix it.

When determining which images to sideload (for kind and k3d), we compare
`localImages` and `deployerImages`. The former from `skaffold.yaml`, and
the latter from Kubernetes manifest files. The image names from
Kubernetes manifests are sanitized in
`pkg/skaffold/kubernetes/manifests/images.go#L51` (and `L113`) in the
call to docker.ParseReference.

The same doesn't happen to image names from `skaffold.yaml`. This change
sanitizes these image names just for determining whether to sideload the
images.

In other parts of the code we look up image pipelines from
`skaffold.yaml` using the image name, so I was hesitant to change how
`localImages` is used (with 'raw' image names).

The hypothesis from the previous commit is disproven, so I'm
adding back the `sha256` tag policy in the custom builder example. To
make the test case easier to identify from the build logs, I renamed the
pod in the custom builder example.

New hypothesis: Could this be related to the issues some users are
reporting with images not being sideloaded when using Helm? E.g., GoogleContainerTools#5159
tejal29 pushed a commit to halvards/skaffold that referenced this issue Aug 11, 2021
I was able to reproduce the issue locally and work out a fix. I'd be
happy for feedback on whether I've chosen the right place to fix it.

When determining which images to sideload (for kind and k3d), we compare
`localImages` and `deployerImages`. The former from `skaffold.yaml`, and
the latter from Kubernetes manifest files. The image names from
Kubernetes manifests are sanitized in
`pkg/skaffold/kubernetes/manifests/images.go#L51` (and `L113`) in the
call to docker.ParseReference.

The same doesn't happen to image names from `skaffold.yaml`. This change
sanitizes these image names just for determining whether to sideload the
images.

In other parts of the code we look up image pipelines from
`skaffold.yaml` using the image name, so I was hesitant to change how
`localImages` is used (with 'raw' image names).

The hypothesis from the previous commit is disproven, so I'm
adding back the `sha256` tag policy in the custom builder example. To
make the test case easier to identify from the build logs, I renamed the
pod in the custom builder example.

New hypothesis: Could this be related to the issues some users are
reporting with images not being sideloaded when using Helm? E.g., GoogleContainerTools#5159
tejal29 pushed a commit that referenced this issue Aug 11, 2021
…ple (#6286)

* Restore import path with uppercase characters

I wasn't able to reproduce the issue described in #5492 and #5505, so
this change restores the import path with the uppercase characters
and the `ko://` prefix in the custom build example.

I had to tweak some values to get the integration tests to run,
because I don't have access to the `k8s-skaffold` project. Let's see
if the build passes.

Additional minor changes:

- Bump the ko version in the custom build example.

- Add the full path to the ko binary in the custom build script, in case
  `$GOPATH/bin` is not on the `PATH`.

Once we move to Go 1.16 for our builds, we can use the `go install`
command to install ko in the custom build shell script.

* Look for ko binary in GOPATH/bin

It's difficult to know what's on the `PATH` in different environments.
This change to the custom builder example looks for the ko binary in the
`GOPATH/bin` directory.

* Remove tagPolicy from custom builder example

Hypothesis: `tagPolicy: sha256` doesn't behave correctly with images
sideloaded into kind snf k3d.

Also fix conditional in custom build example shell script to prevent
recompiling ko each time.

* Sanitize image names before deciding what to load

I was able to reproduce the issue locally and work out a fix. I'd be
happy for feedback on whether I've chosen the right place to fix it.

When determining which images to sideload (for kind and k3d), we compare
`localImages` and `deployerImages`. The former from `skaffold.yaml`, and
the latter from Kubernetes manifest files. The image names from
Kubernetes manifests are sanitized in
`pkg/skaffold/kubernetes/manifests/images.go#L51` (and `L113`) in the
call to docker.ParseReference.

The same doesn't happen to image names from `skaffold.yaml`. This change
sanitizes these image names just for determining whether to sideload the
images.

In other parts of the code we look up image pipelines from
`skaffold.yaml` using the image name, so I was hesitant to change how
`localImages` is used (with 'raw' image names).

The hypothesis from the previous commit is disproven, so I'm
adding back the `sha256` tag policy in the custom builder example. To
make the test case easier to identify from the build logs, I renamed the
pod in the custom builder example.

New hypothesis: Could this be related to the issues some users are
reporting with images not being sideloaded when using Helm? E.g., #5159
@tejal29 tejal29 added priority/p3 agreed that this would be good to have, but no one is available at the moment. and removed priority/p2 May take a couple of releases labels Aug 16, 2021
@wasd171
Copy link

wasd171 commented Mar 18, 2022

Same with k3d cluster, images are not being imported into cluster

Starting deploy...
Loading images into k3d cluster nodes...
Images loaded in 162ns

And afterwards image cannot be loaded within cluster (162ns also looks too optimistic)

Loading the relevant tag by hands via k3d image import works

@chgl
Copy link

chgl commented Oct 24, 2022

Still seeing the same on skaffold v2, kind 0.16.0, k8s 1.25.2. Tested in both Windows 11 and inside WSL2/Ubuntu 22.04.

skaffold dev
# ...
Loading images into kind cluster nodes...
Images loaded in 74ns

But running crictl images doesn't list the images inside the cluster:

$ docker exec kind-control-plane crictl images
IMAGE                                      TAG                  IMAGE ID            SIZE
docker.io/kindest/kindnetd                 v20220726-ed811e41   d921cee849482       25.8MB
docker.io/kindest/local-path-helper        v20220607-9a4d8d2a   d2f902e939cc3       2.86MB
docker.io/kindest/local-path-provisioner   v0.0.22-kind.0       4c1e997385b8f       17.4MB
registry.k8s.io/coredns/coredns            v1.9.3               5185b96f0becf       14.8MB
registry.k8s.io/etcd                       3.5.4-0              a8a176a5d5d69       102MB
registry.k8s.io/kube-apiserver             v1.25.2              9eebd178240fb       76.5MB
registry.k8s.io/kube-controller-manager    v1.25.2              d846cf6e13f87       64.5MB
registry.k8s.io/kube-proxy                 v1.25.2              817f51628b39c       63.3MB
registry.k8s.io/kube-scheduler             v1.25.2              bbff39abe40b4       51.9MB
registry.k8s.io/pause                      3.7                  221177c6082a8       311kB

@Z3po
Copy link

Z3po commented Oct 26, 2022

This completely stopped working with skaffold v2 as it seems.
Setups that were working fine with at least skaffold 1.39.X and 1.26.X stopped uploading images just by using the v2.0.0 binary.

@chgl
Copy link

chgl commented Oct 26, 2022

I've just had a look at the source code, trying to add some Printf debugging with my non-existent Go skills. I believe the issue may be in https://github.com/GoogleContainerTools/skaffold/blob/v2.0.0/pkg/skaffold/deploy/helm/helm.go#L240.

It always passes nil to the LoadImages call as the list of deployerImages. In https://github.com/GoogleContainerTools/skaffold/blob/v2.0.0/pkg/skaffold/kubernetes/loader/load.go#L63, this means that the result of https://github.com/GoogleContainerTools/skaffold/blob/v2.0.0/pkg/skaffold/kubernetes/loader/load.go#L72 is always empty because there are no corresponding images in images for deployerImages, thus it always returns an empty list of images to be loaded -> kind load exits very quickly. Therefore when using kind or k3d together with Helm I don't think it will ever work.

I admittedly don't entirely understand the difference between deployerImages, images, and localImages but just replacing the nil with builds in helm.go at least causes images to be loaded into the cluster.

@mattupstate
Copy link

@chgl can confirm that images are not loaded into a k3d cluster when using Helm to deploy.

image

@Z3po
Copy link

Z3po commented Nov 3, 2022

I've also taken a look into the code when using kustomize/kubectl and the followings are my findings.
I'm not really sure how to solve these in the "right" way so I'm just reporting for someone deeper involved.

First thing I recognized the description in https://github.com/GoogleContainerTools/skaffold/blob/v2.0.1/pkg/skaffold/deploy/kubectl/kubectl.go#L68-L69 seems to be wrong. I guess it should be the other way around? Still I don't know what "originalImages" should be for. If the images should be parsed out of the manifests to be handed to the LoadImages function I can't see where this should happen. It's never set and originalImages is always an empty slice. Therefore the LoadImages function or more precise imagesToLoad will never return any artifact for deployment.

Going further down the road and fixing that code (read: removing the checks for "deployerImages" which is currently dead/unusable code in this case), we're thrown out because we're passing a nil context in https://github.com/GoogleContainerTools/skaffold/blob/v2.0.1/pkg/skaffold/deploy/kubectl/kubectl.go#L233. I assume the childCtx context should be initialized in the line above where the child context is written nowhere (_).

Fixing those reenables image deployment when using kustomize and kind.

I'm not sure how this whole image selection was meant to work in the beginning so unfortunately I cannot work on a pull request to fix it.

@Z3po
Copy link

Z3po commented Nov 4, 2022

Just learned that at least part of this issue is the same as #7992 . There's also a MR linked that looks like it's solving the issue.

@ericzzzzzzz
Copy link
Contributor

Should be fixed now by #8007, i'm gonna close this issue. Please feel free to re-open it if you guys see the same issue again after V 2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy kind/bug Something isn't working priority/p3 agreed that this would be good to have, but no one is available at the moment.
Projects
None yet
Development

No branches or pull requests

10 participants