skaffold: Skaffold v0.23.0 + Windows 10 regression: didn't sync any files

Expected behavior

Sync files when it changes

Actual behavior

Did not sync files. Always shows “didn’t sync any files”

Information

  • Skaffold version: v0.23.0
  • Operating system: Windows 10
  • Contents of skaffold.yaml:
Any yamls I tried

Steps to reproduce the behavior

  1. Update to v0.23.0 from v0.22.0
  2. Sync stops working

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 22 (9 by maintainers)

Most upvoted comments

Here’s a workaround that fixes Skaffold Sync at least for me.

Wrap skaffold dev in a script which

  • first resets the current namespace,
  • starts a subshell in the background that’ll switch back into the namespace you were,
  • and runs skaffold dev
_dev() {
  local current_ns; current_ns="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
  kubectl config set-context --current --namespace=
  (sleep 3 && kubectl config set-context --current --namespace="${current_ns}" ) &
    
  skaffold dev
}

You may need to adjust sleep 3 for your environment.

This problem still exists in Skaffold 1.5.0.

Fyi @dgageot here’s the small repro that you asked for.

Every once in a while, I have been experiencing WARN[0032] Skipping deploy due to sync error: copying files: didn't sync any files . This comment was a key for me: https://github.com/GoogleContainerTools/skaffold/issues/1668#issuecomment-466633791

I have Minikube 1.7.3, Kustomize 3.5.4 and Skaffold 1.4.0 with multiple applications in different Kubernetes namespaces.

PROBLEM: Namespace in $KUBECONFIG affects Skaffold Sync

Skaffold sync will only work when the Kubernetes namespace in $KUBECONFIG, at the time of starting Skaffold, matches the namespace of the artifact (application) being deployed.

The critical moment is when Skaffold starts. After Skaffold is running, I can change my current namespace in $KUBECONFIG and Skaffold sync works neatly. But, if the namespace in $KUBECONFIG is different from the hot-sync-artifact’s namespace when Skaffold starts, then sync will fail with error WARN[0032] Skipping deploy due to sync error: copying files: didn't sync any files .

For Skaffold Sync to work, the namespace in $KUBECONFIG must either be undefined or it must equal to the hot-sync-artifact’s namespace.

EXAMPLE: Namespace undefined

Without namespace being defined, Skaffold Sync works for artifacts in any namespace:

apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/pre/.minikube/ca.crt
    server: https://192.168.64.100:8443
  name: rex
contexts:
- context:
    cluster: rex
    user: rex
  name: rex
current-context: rex
kind: Config
preferences: {}
users:
- name: rex
  user:
    client-certificate: /Users/pre/.minikube/client.crt
    client-key: /Users/pre/.minikube/client.key

EXAMPLE: Namespace defined

Here namespace is defined and Skaffold Sync will fail for all artifacts (applications) which are not deployed in dev namespace:

apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/pre/.minikube/ca.crt
    server: https://192.168.64.100:8443
  name: rex
contexts:
- context:
    cluster: rex
    namespace: dev
    user: rex
  name: rex
current-context: rex
kind: Config
preferences: {}
users:
- name: rex
  user:
    client-certificate: /Users/pre/.minikube/client.crt
    client-key: /Users/pre/.minikube/client.key

A workaround is to run skaffold dev with --trigger=polling

Same here, no syncing after the update. Here’s the console output (no error messages):

INFO[0048] files modified: [main.js]
Syncing 1 files for laander/myproject:a8db8a26762164d0d916ce0f7f29cd0db6388a5d74def8327003715c66daa368
INFO[0049] Copying files: map[main.js:main.js] to laander/myproject:a8db8a26762164d0d916ce0f7f29cd0db6388a5d74def8327003715c66daa368
DEBU[0049] Running command: [kubectl exec myproject-myproject-754cfb94cb-7cpqm --namespace default -c myproject -i -- tar xmf - -C / --no-same-owner]
Watching for changes every 1s...

Node.js app with nodemon refreshing upon file change

MacOS Mojave v10.14.3 Docker Desktop v2.0.2.0 Kubernetes v1.13.0

Nope: MacOs Mojave 10.14.3

everything running in the default namespace

Maybe this will be helpful:

Linux environment. I see that problem when my context namespace differ from a namespace defined for Helm chart, for example:

- context:
    cluster: minikube
    namespace: test
    user: minikube
  name: minikube
current-context: minikube

Case 1:

  • there is no namespace defined in skaffold.yaml,
  • there is test namespace defined in skaffold.yaml Result:
  • sync working as expected

Case 2:

  • there is namespace defined in Helm Chart with a different name then in context,
  • there is staging namespace defined in skaffold.yaml Result:
  • sync is not working at all

Where is a bug? Well, probably skaffold do not use proper namespace after deployment to communicate with the cluster?

Workaround: Always change context namespace to a namespace defined in skaffold.yaml or Helm chart before using skaffold.