0

I have a Kubernetes Daemonset running on my GKE cluster version:

Server Version: version.Info{Major:"1", Minor:"9+", GitVersion:"v1.9.6-gke.1", GitCommit:"cb151369f60073317da686a6ce7de36abe2bda8d", GitTreeState:"clean", BuildDate:"2018-04-07T22:06:59Z", GoVersion:"go1.9.3b4", Compiler:"gc", Platform:"linux/amd64"}

When a pod gets deleted, my containers are handling the issued SIGTERM normally and shutting down. Both containers in the pod report the following immediately:

State: Terminated Reason: Completed Exit Code: 0 Started: Tue, 22 May 2018 17:09:39 -0500 Finished: Tue, 22 May 2018 17:24:11 -0500 Ready: False

However, the pod remains in Ready: 0/2, Status: Terminating for about 30 seconds afterward. Any ideas about why that might happen or how to diagnose it?

0

If we focus on deletion part you describe, we can refer to kubectl delete help to figure that pod ressource has grace-period

Some resources, such as pods, support graceful deletion. These resources > define a default period before they are forcibly terminated (the grace > period) but you may override that value with the --grace-period flag, or > pass --now to set a grace-period of 1.

You could try :

kubectl delete pod NAME --grace-period=0

PS: could you explain more relation between Daemonset and deleted pod?

0

The default grace period is 30s. As any default, it may or may not fit your use case. There are two ways to change the grace period:

1.In the yaml file

For example, the following .yaml shows a simple DaemonSet config with a 30 seconds termination grace period

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
.
.
.

terminationGracePeriodSeconds: 30

2.On the command line, you run “kubeclt delete”

For example,

kubectl delete pod NAME --grace-period=0

for a force delete as per @Zied post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.