Asking for help? Comment out what you need so we can get more information to help you!
Cluster information:
Kubernetes version:
Client Version: v1.25.4
Kustomize Version: v4.5.7
Server Version: v1.25.4
Cloud being used: AWS
Installation method: kOps
Host OS: Ubuntu
CNI and version: 3.24.5
CRI and version: 1.6.10
Question:
My Rolling Update strategy setting goes well when do “kubectl rollout restart {deployment name}”. However, when I run “kubectl apply -f {this manifest}”, RollingUpdate does not work and it causes termination and creation of all pods immediately, on the same timing. It prevent my system from no-interruption. any advice?
Manifest:
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: web
name: web
namespace: default
spec:
replicas: 3
revisionHistoryLimit: 1
selector:
matchLabels:
app: web
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: web
spec:
imagePullSecrets:
- name: docker-hub-secret
initContainers:
- name: check-init-flag
image: busybox
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /etc/host/sync/init_flag ]; then
echo "ERR: $(date -u -d '+9 hours') $(hostname) init_flag not found." >> /var/persistent/log/init_error.log
exit 1
fi
volumeMounts:
- name: persistent-storage01
mountPath: "/var/persistent/"
- name: host-etc
mountPath: "/etc/host/"
containers:
- name: web
image: repo/example:web3
resources:
requests:
cpu: "350m"
limits:
cpu: "900m"
command: ["/usr/bin/bash", "-c"]
args:
- |
cp -pr /var/persistent/k8s/web/00_entrypoint.sh /entrypoint.sh
exec /entrypoint.sh
lifecycle:
postStart:
exec:
command: ["/usr/bin/bash", "-c", "/var/persistent/k8s/web/01_poststart.sh"]
preStop:
exec:
command: ["/usr/bin/bash", "-c", "/var/persistent/k8s/web/02_prestop.sh"]
volumeMounts:
- name: persistent-storage01
mountPath: "/var/persistent/"
- name: host-varlog
mountPath: "/var/log/host/"
- name: host-etc
mountPath: "/etc/host/"
terminationGracePeriodSeconds: 20
volumes:
- name: persistent-storage01
persistentVolumeClaim:
claimName: efs-claim
- name: host-varlog
hostPath:
path: "/var/log"
- name: host-etc
hostPath:
path: "/etc"