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

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

Open
ShrutiC-git opened this issue Feb 2, 2024 · 1 comment

Comments

@ShrutiC-git
Copy link

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 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 <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:
---
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 <personal-dockerhub-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 <dockerhub-repo>/currencyservice:v0.5.0-795-g996a6e1-dirty@sha256:d620c1148df8a74b31daf9b603e96baa619415d8a0459839328e99d5c6f5189d
INFO[0051] Copying files:map[src/currencyservice/server.js:[/usr/src/app/server.js]]to<dockerhub-repo>/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.

@ericzzzzzzz
Copy link
Contributor

hi @ShrutiC-git , to make your change reflect on your application, the application needs to aware the changes and do the updates itself, for node application, it requires container uses nodemon to start the application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants