4

I use skaffold for k8s based microservices app. I enter skaffold dev and skaffold run to run and skaffold delete to restart all microservices.

If I need to restart only one service, what must I do?

Yasin Okumuş
  • 2,299
  • 7
  • 31
  • 62

2 Answers2

2

According to the docs:

  • Use skaffold dev to build and deploy your app every time your code changes,
  • Use skaffold run to build and deploy your app once, similar to a CI/CD pipeline

1. Deploy your services:

    skaffold run --filename=skaffold_test_1.yaml

(in addition you can have multiple workflow configurations).

2. Change your skaffold workflow configuration and run:

skaffold delete --filename=skaffold_test2.yaml

Using this approach your deployments will be not removed like in the skaffold dev command after stopping skaffold.

Basically managing the content of the skaffold workflow configuration (by adding or removing additional entries allows you to deploy or remove particular service).

apiVersion: skaffold/v1
kind: Config
.
.
.

deploy:
  kubectl:
    manifests:
    - k8s-service1.yaml
#   - k8s-service2.yaml    
Mark
  • 3,644
  • 6
  • 23
  • Thank you very much. I could delete one resource as you have stated. It got unbound from the main `skaffold dev` terminal. I run it as you have stated but it didn't get bound again. I had to restart everything again – Yasin Okumuş Aug 19 '20 at 09:31
  • It's not clear what do you mean. If there still is an issue please update the question. The main difference is how `dev` works vs `run`. In the first example dev is watching for changes in the skaffold file while `run` is performing all tasks only once. So you can run your steps, than change your skaffold.yaml and perform for example delete one resource (as stated in the example above) it will remove all manifest from the skaffold.yaml (it's your responsibility to maintain this file properly). – Mark Aug 19 '20 at 09:50
1

You can use skaffold dev's --watch-image flag to restrict the artifacts to monitor. This takes a comma-separated list of images, specified by the artifact.image.

Brian de Alwis
  • 2,814
  • 2
  • 18
  • 32