lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.51k stars 1.47k forks source link

for pv, lens not reflecting true K8 state but kubectl does #3301

Open papillon88 opened 3 years ago

papillon88 commented 3 years ago

Using LENS 5.0.2. But I experienced the issue even with 4.2.4 After deleting the PV using kubectl. kubectl shows no PV : image (7) But Lens still shows PV is active : image (8) I've waited to 3-4hrs for the GUI to refresh automatically, but I still see the PV in the GUI. I have to restart Lens everytime to refresh the GUI to reflect the true K8 state. Please have a look. Thanks

papillon88 commented 3 years ago

Also Ctrl + R solves the issue sometimes on windows - but most of the times Ctrl + R indefinitely freezes the entire Lens GUI and as a result I have to shutdown Lens and restart it

jim-docker commented 3 years ago

Hi, can you provide some logs from the Developer Tools console?

scaleoutsean commented 3 years ago

I see the same problem with 5.0.2-latest (20210705.2) using NetApp Trident CSI with SolidFire iSCSI back-end and K8s v1.21.2 (Ubuntu 20.04).

In my case with Lens on Ubuntu 20.04, CTRL+R helped me refresh and update ghost PVs, making them disappear. But later it crashed /persistent-volumes app (crash log can be found at the bottom of this comment).

Interestingly, on the second try it was PVC that got stuck in the Lens UI, while the PV was properly cleared when kubectl del pv was executed. It appears that what happens depends on timing. For example, if I execute create PVC/delete PVC very quickly, I don't end up with ghost PVs (or PVCs).

On the third try I got the previous behavior, where a PV remained in Lens after its PVC was deleted. I don't know how, but there was an error in the red-colored response (see screenshot):

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "persistentvolumes \"pvc-0cc7c1cd-fea0-4765-b6cc-07ed177b9a3a\" not found",
  "reason": "NotFound",
  "details": {
    "name": "pvc-0cc7c1cd-fea0-4765-b6cc-07ed177b9a3a",
    "kind": "persistentvolumes"
  },
  "code": 404
}

image

I don't know what I did to get that error appear in the log.

Later, JSON responses became correct (empty), but the UI was still showing the ghost PV:

{
  "kind": "PersistentVolumeList",
  "apiVersion": "v1",
  "metadata": {
    "resourceVersion": "17491424"
  },
  "items": []
}

image

In Console I noticed this:

json-api.ts:141 DELETE http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/api-kube/api/v1/persistentvolumes/pvc-0cc7c1cd-fea0-4765-b6cc-07ed177b9a3a 404 (Not Found)
request @ json-api.ts:139
del @ json-api.ts:117
delete @ kube-object.ts:295
remove @ kube-object.store.ts:293
executeAction @ mobx.esm.js:1128
remove @ mobx.esm.js:1112
remove @ kube-object-menu.tsx:69
executeAction @ mobx.esm.js:1128
ObservableObject.key @ mobx.esm.js:1112
value @ confirm-dialog.tsx:92
(anonymous) @ prevDefault.ts:39
Rb @ react-dom.production.min.js:52
Xb @ react-dom.production.min.js:52
Yb @ react-dom.production.min.js:53
Ze @ react-dom.production.min.js:100
se @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
Jb @ react-dom.production.min.js:292
Nb @ react-dom.production.min.js:50
jd @ react-dom.production.min.js:105
yc @ react-dom.production.min.js:75
hd @ react-dom.production.min.js:74
exports.unstable_runWithPriority @ scheduler.production.min.js:18
gg @ react-dom.production.min.js:122
Hb @ react-dom.production.min.js:292
gd @ react-dom.production.min.js:73
json-api.ts:141 Fetch failed loading: DELETE "http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/api-kube/api/v1/persistentvolumes/pvc-0cc7c1cd-fea0-4765-b6cc-07ed177b9a3a".
request @ json-api.ts:139
del @ json-api.ts:117
delete @ kube-object.ts:295
remove @ kube-object.store.ts:293
executeAction @ mobx.esm.js:1128
remove @ mobx.esm.js:1112
remove @ kube-object-menu.tsx:69
executeAction @ mobx.esm.js:1128
ObservableObject.key @ mobx.esm.js:1112
value @ confirm-dialog.tsx:92
(anonymous) @ prevDefault.ts:39
Rb @ react-dom.production.min.js:52
Xb @ react-dom.production.min.js:52
Yb @ react-dom.production.min.js:53
Ze @ react-dom.production.min.js:100
se @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
Jb @ react-dom.production.min.js:292
Nb @ react-dom.production.min.js:50
jd @ react-dom.production.min.js:105
yc @ react-dom.production.min.js:75
hd @ react-dom.production.min.js:74
exports.unstable_runWithPriority @ scheduler.production.min.js:18
gg @ react-dom.production.min.js:122
Hb @ react-dom.production.min.js:292
gd @ react-dom.production.min.js:73
json-api.ts:141 Fetch finished loading: POST "http://0fb98e9710162f2a5c11910625f8117f.localhost:46739/api/metrics?start=1626152820&end=1626156420&step=60&kubernetes_namespace=".
request @ json-api.ts:139
post @ json-api.ts:105
getMetrics @ metrics.api.ts:74
getMetrics @ nodes.api.ts:30
loadUsageMetrics @ nodes.store.ts:48
executeAction @ mobx.esm.js:1128
loadUsageMetrics @ mobx.esm.js:1112
(anonymous) @ nodes.tsx:61
tick @ interval.ts:32

When trying to manually delete the ghost PV:

image

When I pressed CTRL+R this time (with Debug Console open), it crashed /persistent-volumes.

image

Text:

Component stack:

    at KubeObjectDetails (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:506895:9)
    at ErrorBoundary (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:474984:9)
    at Router (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:18291:30)
    at App (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:531355:9)
    at ThemeProvider (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:555915:24)

Error stack:

TypeError: Cannot read property 'includes' of undefined
    at parseKubeApi (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:499003:29)
    at api_manager_ApiManager.getApi (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:499660:67)
    at api_manager_ApiManager.resolveApi (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:499679:25)
    at api_manager_ApiManager.getStore (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:499699:43)
    at KubeObjectDetails.get object (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:506944:34)
    at trackDerivedFunction (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1881:18)
    at ComputedValue.computeValue_ (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1657:13)
    at ComputedValue.trackAndCompute (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1637:25)
    at ComputedValue.get (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1608:18)
    at ObservableObjectAdministration.getObservablePropValue_ (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:4787:34)
    at KubeObjectDetails.get (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:5326:26)
    at KubeObjectDetails.render (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:506953:17)
    at allowStateChanges (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1329:12)
    at http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:471638:59
    at trackDerivedFunction (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:1881:18)
    at Reaction.track (http://6fea49c6cd1a30e879ff255de33a3714.localhost:46739/build/Lens.js:2409:18)