With default settings, a deployment consisting of n
replicas of a service will follow the below order during deploy:
Start pod 1
-> Wait for pod 1
to be ready
Once pod 1
is ready, start pod 2
-> Wait for pod 2
to be ready
...
Once pod n-1
is ready, start pod n
-> Wait for pod n
to be ready
In my application, it takes several minutes before the service can accept traffic (is ready). Hence I would like to configure my deployment to follow:
Start pod 1
-> Start pod 2
... -> Start pod n
Once all pods are started, wait for pods 1
to n
to become ready.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-webservice
spec:
replicas: n
selector:
matchLabels:
app.kubernetes.io/name: my-webservice
template:
metadata:
labels:
app: my-webservice
app.kubernetes.io/name: my-webservice
spec:
securityContext:
runAsNonRoot: true
containers:
- name: my-webservice
image: "my.docker.repo/my-webservice:latest"
ports:
- containerPort: 5000
readinessProbe:
httpGet:
path: /ready
port: 5000
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 360
How can I configure this?
You may try to add .spec.strategy.rollingUpdate.maxSurge field in your deployment.yml (Check here)
I think what you need is to set maxSurge: n
In your example:
Thus, when you apply an update, n new pods will be created simultaneously.