Kubernetes Replication controller deletion

1/12/2017

I have Kunernetes pods and replication controller running on AWS EC2 instances. If the status of pods are fail or crash then the replication controller that creates that pods has to deleted after after 5 minutes.

Basically what I want is when I run the command:

"kubectl get pods --namespace=<namespace>"

I want to consider the status column results and where ever if there is ClashloopBackOff then those pods has to be deleted after 5 minutes.

This is what I want to automate and looking forward to write a shell-script for that.

-- Vaibhav Jain
devops
docker
kubernetes
kubernetes-health-check
shell

1 Answer

1/18/2017

Pods managed by a ReplicationController will attempt to be healthy basically forever. If the pod crashes, then it will be restarted and attempted again. If this happens a number of times, then it will go into an exponential backoff where it will wait longer times incrementally (e.g. 30 seconds, then 1 minute, then 2 minutes, etc) before attempting to restart again.

-- Steve Sloka
Source: StackOverflow