I'm using default deployment strategy for my load-balancer service in kubernetes, and when I describe my deployment the strategy looks like follows:
Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0 RollingUpdateStrategy: 1 max unavailable, 1 max surge
So according to the description, there should not be any downtime. However, there's still a downtime in the service. How can I make sure there's zero downtime?
From what I can see you are using the as fast as possible
approach of Rolling Updates
.
While this is a good approach it's better to use Replicas: 3
, because you might end up with 2 pods
down during update.
You should implement ReadinessProbe
that might look like the following:
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
initialDelaySeconds
: Number of seconds after the container has started before readiness probes are initiated.periodSeconds
: How often to perform the probe. Default to 10 seconds.successThreshold
: Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1.I also recommend reading Enable Rolling updates in Kubernetes with Zero downtime, as they nicely explains the use of Rolling updates.