Kubernetes Clustsr stuck on removing PV/PVC

4/14/2019

I am been struggling to get my simple 3 node Kubernetes cluster running.

$ kubectl get nodes                                                                                    NAME   STATUS   ROLES         AGE   VERSION
ubu1   Ready    master        31d   v1.13.4
ubu2   Ready    master,node   31d   v1.13.4
ubu3   Ready    node          31d   v1.13.4

I tried creating a PVC, which was stuck in Pending forever. So I deleted it, but now it is stuck in Terminating status.

$ kubectl get pvc
NAME                        STATUS        VOLUME           CAPACITY   ACCESS MODES   STORAGECLASS      AGE
task-pv-claim               Terminating   task-pv-volume   100Gi      RWO            manual            26d

How can I create a PV that is properly created and useable for the demos described on the official kubernetes web site?

PS: I used kubespray to get this up and running.

On my Ubuntu 16.04 VMs, this is the Docker version installed:

ubu1:~$ docker version
Client:
 Version:           18.06.2-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        6d37f41
 Built:             Sun Feb 10 03:47:56 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Thanks in advance.

-- farhany
kubernetes

2 Answers

4/14/2019

You can use following command to delete the PV or PVC forcefully.

#kubectl delete pvc <PVC_NAME> --grace-period=0 --force 

in your case

#kubectl delete pvc task-pv-claim  --grace-period=0 --force 
-- yasin lachini
Source: StackOverflow

1/24/2020

kubectl edit pv (pv name)

FIND the following

finalizers: - kubernetes.io/pv-protection

AND delete it. Then exit and: kubectl delete pv (pv name) --grace-period=0 --force

-- Dragomir Ivanov
Source: StackOverflow