A Solution to Kubernetes pods stuck on Terminating

5/29/2018

I was one that was having trouble with this above mentioned issue where after a "kubectl delete -f" my container would be stuck on "Terminating". I could not see anything in the Docker logs to help me narrow it down. After a Docker restart the pod would be gone and i could continue as usual, but this is not the way to live your life.

I Googled for hours and finally got something on a random post somewhere.

Solution: When i installed Kubernetes on Ubuntu 16.04 i followed a guide that said to install "docker.io". In this article it said to remove "docker.io" and rather use a "docker-ce or docker-ee" installation.

BOOM, i did it, disabled the swappoff function and my troubles are no more.

I hope this helps people that are also stuck with this.

Cheers

-- kleuf
docker
kubernetes
ubuntu-16.04

1 Answer

5/29/2018

As kleuf mentioned in comments, the solution to the stuck docker container in his case was the following:

When i installed Kubernetes on Ubuntu 16.04 i followed a guide that said to install "docker.io". In this article it said to remove "docker.io" and rather use a "docker-ce or docker-ee" installation.

sudo apt-get remove docker docker-engine docker-ce docker.io 
sudo apt-get remove docker docker-engine docker.io -y 
curl -fsSL download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 
sudo add-apt-repository  "deb [arch=amd64] download.docker.com/linux/ubuntu  $(lsb_release -cs)  stable" 
sudo apt-get update 
sudo apt-get install docker-ce -y 
sudo service docker restart

BOOM, i did it, disabled the swappoff function and my troubles are no more.

I hope this helps people that are also stuck with this.

-- VAS
Source: StackOverflow