
ArrĂȘt correct du conteneur dans Kubernetes
(. . â ) Kubernetes-. , drain . , : podâ.
podâ
kubectl drain
podâ . , :
drain
podâ control plane. kubelet
, podâ.kubelet
podâ preStop
preStop
, kubelet
TERM
podâ.kubelet
( podâ, ; 30 ) , ( SIGKILL
). preStop
.
, preStop
, â â . , , , TERM
, , , , . , , TERM
(, - ), preStop
API, .
Nginx TERM
, . preStop
. resource lifecycle
. lifecycle
:
lifecycle:
preStop:
exec:
command: [
# Gracefully shutdown nginx
"/usr/sbin/nginx", "-s", "quit"
]
, , SIGTERM
Nginx /usr/sbin/nginx -s quit
. , , Nginx pod, TERM
noop ( â .).
Nginx. , Deployment
:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.15
ports:
- containerPort: 80
lifecycle:
preStop:
exec:
command: [
# Gracefully shutdown nginx
"/usr/sbin/nginx", "-s", "quit"
]
podâ
podâ Nginx , . , , , Nginx , .
, deployment. , , . . podâ.

, Node 1. kubectl drain node-1
, kubelet
preStop
, Nginx:

nginx , . , nginx , , .
, . pod, . , , nginx :

, nginx , podâ drain
:


, , podâ , . , , .
? , , ? , podâ , preStop
, Service
.
Kubernetes AWS , Gruntwork.io.
: