Search code examples
kuberneteskubectl

kubectl apply vs kubectl roll-update


If there an use case where kubectl apply should not be use to get a roll-update?

Despite the command original intent if we gave to kubectl apply a source file describing the resources of the cluster been updated over time, there any use case on which should not be use?


Solution

  • The update strategy is specified in .spec.strategy in case of a Deployment and .spec.updateStrategy.type for DaemonSets and StatefulSets

    For Deployments .spec.strategy.type can be “Recreate” or “RollingUpdate”. “RollingUpdate” is the default value.

    For DaemonSets and StatefulSets, .spec.updateStrategy.type can be "OnDelete" or "RollingUpdate". "OnDelete" is the default value.

    kubectl apply will respect these strategies, so I see no reason why not using it.

    kubectl rolling-update is used only for ReplicationControllers which were replaced by Deployments