Search code examples
kubernetesskaffold

Does skaffold respect rolling updates?


Does skaffold respect rolling updates when the --force option is used? When I execute skaffold run --force with

  replicas: 3
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 3

It seems that surge never occurs.

In another terminal window I run watch kubectl get pods and I never see the number of replicas for my deployment go above 3. I suspect this is because of the --force flag but I'm not sure.

Before people tell me to not use force, see https://github.com/GoogleContainerTools/skaffold/issues/3171. Skaffold automatically changes the run-id which causes deployments to fail if resources for the deployment already exist. That being said, if there's a way to tell skaffold to update a deployment without complaining about mismatched run-ids, I'd love to hear. I'm not a fan of using --force.

EDIT:

Looking at the skaffold help I see:

      --force=false: Recreate Kubernetes resources if necessary for deployment, warning: might cause downtime! (true by default for `skaffold dev`)

The Recreate word suggests that the RollingDeployment strategy might not be respected.


Solution

  • After more testing I can confirm that using --force causes the deployment strategy to ignored. To get around the run-id problem I mentioned I

    1. Did a force deployment with -l skaffold.dev/run-id=test
    2. Did another deployment without --force and with the same run-id from the previous step.

    When I did this I saw the surge I expected.