kubernetes / kubernetes/kubectl
Inconsistent output for kubectl with -o json and without for pvc/pv
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
**What happened**: After deleting pvc/pv I am checking pvc/pv status and I see different output for kubectl get pv pvc-name -o json
and kubectl get pv pvc-name
**What you expected to happen**: Output should be the same.
██kubectl get pv pvc-e1588d5b-e939-490a-b7cc-eb48c3a74347
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-e1588d5b-e939-490a-b7cc-eb48c3a74347 15Gi RWO Delete Terminating default/pvc-vcp vcp 120m
██kubectl get pv pvc-e1588d5b-e939-490a-b7cc-eb48c3a74347 -o json
{
"apiVersion": "v1",
"kind": "PersistentVolume",
"metadata": {
"annotations": {
"kubernetes.io/createdby": "vsphere-volume-dynamic-provisioner",
"pv.kubernetes.io/bound-by-controller": "yes",
"pv.kubernetes.io/provisioned-by": "kubernetes.io/vsphere-volume"
},
"creationTimestamp": "2023-08-18T12:15:53Z",
"deletionGracePeriodSeconds": 0,
"deletionTimestamp": "2023-08-18T13:14:49Z",
"finalizers": [
"kubernetes.io/pv-protection"
],
"name": "pvc-e1588d5b-e939-490a-b7cc-eb48c3a74347",
"resourceVersion": "13689821",
"uid": "c407f53b-01cc-4b1f-a897-19ae8211b98b"
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"capacity": {
"storage": "15Gi"
},
"claimRef": {
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"name": "pvc-vcp",
"namespace": "default",
"resourceVersion": "13679572",
"uid": "e1588d5b-e939-490a-b7cc-eb48c3a74347"
},
"persistentVolumeReclaimPolicy": "Delete",
"storageClassName": "vcp",
"volumeMode": "Filesystem",
"vsphereVolume": {
"fsType": "ext4",
"volumePath": "[vsanDatastore] bd8b2463-3423-e41a-e2f5-bc97e1cbe040/clustera-dynamic-pvc-e1588d5b-e939-490a-b7cc-eb48c3a74347.vmdk"
}
},
"status": {
"phase": "Bound"
}
}
Status should be Terminating
**How to reproduce it (as minimally and precisely as possible)**:
Create pvc/pv and example nginx deployment. Delete pvc/pv. PVC/PV will be in terminating state because volume has an attachment.
-->
**Environment**:
-
- Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:20:54Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.17+vmware.1", GitCommit:"bc3f3c608032e00c0923cf1940e4f580b00fbf4d", GitTreeState:"clean", BuildDate:"2023-03-15T09:56:15Z", GoVersion:"go1.19.6", Compiler:"gc", Platform:"linux/amd64"}
- Cloud provider or hardware configuration:
- OS (e.g: `cat /etc/os-release`):
Contributor guide
Research direction
Start with the `kubectl get pv pvc-name` and `kubectl get pv pvc-name -o json` entry points described in the report, reproducing them after deleting a PVC/PV with an attached volume. Trace how the table output derives the PV status versus the JSON object's status, and consider the issue done when both commands report the expected terminating state consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100