Một số lỗi vận hành k8s

 

  1. How to fix in Kubernetes – Deleting a PVC stuck in status “Terminating”
The Issue

Whilst working on a Kubernetes demo for a customer, I was cleaning up my environment and deleting persistent volume claims (PVC) that were no longer need.

I noticed that one PVC was stuck in “terminating” status for quite a while.
Note: I am using the OC commands in place of kubectl due to this being a Openshift environment

The Cause

I had a quick google and found I needed to verify if the PVC is still attached to a node in the cluster.

kubectl get volumeattachment

I could see it was, and the reason behind this was the configuration for the PVC was not fully updated during the delete process.
The Fix

I found the fix on this github issue log .

You need to patch the PVC to set the “finalizers” setting to null, this allows the final unmount from the node, and the PVC can be deleted.

kubectl patch pvc {PVC_NAME} -p '{"metadata":{"finalizers":null}}'
Regards



  1. How to fix in Kubernetes – Deleting a namespace stuck in status “Terminating”
a.tmp.json:

{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": {
"name": "cattle-system"
},
"spec": {
"finalizers": []
}
}

b. kubectl replace --raw "/api/v1/namespaces/cattle-system/finalize" -f ./tmp.json

Nhận xét

Bài đăng phổ biến từ blog này

ActiveMQ 5.x

Redo and undo Log in MySQL transaction

[Kubernetes Series] - Bài 19 - Adding custom resource to Kubernetes