GoogleContainerTools / GoogleContainerTools/skaffold

Sync copies file changes to the deployed container however the changes are not reflected post successful syncing

Open
#9,292 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior
After Skaffold successfully syncs a file, that is, the changes made are copied over to the deployed container's filesystem, I should be able to see the new changes in my application.

### Actual behavior
Running the [microservices with Skaffold example](https://github.com/GoogleCloudPlatform/microservices-demo/tree/main) provided by Google to figure Skaffold's sync functionality for a private project.

I added `sync: infer` to the `skaffold.yaml` file. The infer mode is set on all files - `**/*` for all the services in the project. When I make a change to any one of the service, and run `skaffold dev --default-repo --trigger polling -v info`, I can see that skaffold is syncing the changes. Upon exec-ing into the container, I can also see that the file on the container now contains the change I made. However, I'm not seeing the change reflected in my application.

### Information

- Skaffold version: v2.10.0
- Operating system: Ubuntu on wsl2
- Installed via: snap
- Contents of skaffold.yaml:

```yaml
---
apiVersion: skaffold/v4beta9
kind: Config
metadata:
name: app
build:
artifacts:
# image tags are relative; to specify an image repo (e.g. GCR), you
# must provide a "default repo" using one of the methods described
# here:
# https://skaffold.dev/docs/concepts/#image-repository-handling
- image: emailservice
context: src/emailservice
sync:
infer:
- "**/*"
kaniko:
dockerfile: Dockerfile
- image: productcatalogservice
context: src/productcatalogservice
sync:
infer:
- "**/*"
kaniko:
dockerfile: Dockerfile
- image: recommendationservice
context: src/recommendationservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: shippingservice
context: src/shippingservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: checkoutservice
context: src/checkoutservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: paymentservice
context: src/paymentservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: currencyservice
context: src/currencyservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: cartservice
context: src/cartservice/src
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: frontend
context: src/frontend
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
- image: adservice
context: src/adservice
kaniko:
dockerfile: Dockerfile
sync:
infer:
- "**/*"
cluster: {}

manifests:
kustomize:
paths:
- kubernetes-manifests
deploy:
kubectl: {}
---
apiVersion: skaffold/v4beta6
kind: Config
metadata:
name: loadgenerator
requires:
- configs:
- app
build:
artifacts:
- image: loadgenerator
context: src/loadgenerator
manifests:
rawYaml:
- ./kubernetes-manifests/loadgenerator.yaml
deploy:
kubectl: {}
```

### Steps to reproduce the behavior

1. Edit the Dockerfile/s in the project above so the filesystem is not ReadOnly
2. `skaffold dev --default-repo --trigger polling -v info`
3. When the deployment is up, make a change to any service's source code. I'm testing with changing the logger message.
4. Check the logs from Skaffold - a _Copying_ log will pop
5. Wait till the sync is completed.
6. exec into the container for the service you made changes to -> the file would have changes
7. Check back with the application -> the logger message is still the same. The changes are not reflected.

```
INFO[0050] files modified: [src/currencyservice/server.js] subtask=-1 task=DevLoop
Syncing 1 files for /currencyservice:v0.5.0-795-g996a6e1-dirty@sha256:d620c1148df8a74b31daf9b603e96baa619415d8a0459839328e99d5c6f5189d
INFO[0051] Copying files:map[src/currencyservice/server.js:[/usr/src/app/server.js]]to/currencyservice:v0.5.0-795-g996a6e1-dirty@sha256:d620c1148df8a74b31daf9b603e96baa619415d8a0459839328e99d5c6f5189d subtask=-1 task=DevLoop
Watching for changes every 1s...
```
I'm running `skaffold dev` on a remote cluster on GKE. The local _kubeConfig_ points to this cluster. It possibly could be something that has to do with how the images are tagged and/or pulled by skaffold on the cluster.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.