kube-aws / kube-spot-termination-notice-handler

A Kubernetes DaemonSet to gracefully delete pods 2 minutes before an EC2 Spot Instance gets terminated
Apache License 2.0
378 stars 77 forks source link

How to remove --force from drain command ? #47

Open sriharim opened 4 years ago

sriharim commented 4 years ago

Hi,

Due to --force drain - application is closing connection in Nginx containers ( Using all spot instances for Kubernetes cluster )

I would like to remove --force from below command in entrypoint.sh.

kubectl drain "${NODE_NAME}" --force --ignore-daemonsets --delete-local-data --grace-period="${GRACE_PERIOD}"

please let me know possible solution.

Thanks

maksim-paskal commented 3 years ago

--force option in drain operation (https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#drain) only

Continue even if there are pods not managed by a ReplicationController, Job, or DaemonSet

removing --force do not resolve your problem, try to use preStop hook in nginx pod - https://blog.gruntwork.io/gracefully-shutting-down-pods-in-a-kubernetes-cluster-328aecec90d