lens
lens copied to clipboard
422 error on prometheus metrics
Describe the bug I'm trying to connect Lens to Prometheus (installed with kube-prometheus-stack helm chart (45.29.0))
To Reproduce Steps to reproduce the behavior:
- Enable metrics
- Configure endpoint
Expected behavior Metrics to be showing
Environment (please complete the following information):
- Lens Version: 2023.08.290146-latest
- OS: [e.g. OSX] Ubuntu 23.04
- Installation method (e.g. snap or AppImage in Linux): DEB package
Logs: When you run the application executable from command line you will see some logging output. Please paste them here:
[METRICS-ROUTE]: failed to get metrics for clusterId=0f96f2b596cd0d0f94565a1c74aa0ac2: Metrics not available +953ms
[ 1] Error: Metrics not available
[ 2] at loadMetricHelper (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35829:31)
[ 3] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ 4] at async Promise.all (index 0)
[ 5] at async /opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35874:36
[ 6] at async Object.route (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:34859:32)
[ 7] at async Router.route (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35090:9)
[ 8] at async LensProxy.handleRequest (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:33367:13)
[ 9] Cause:
[ 10] 'Error: Failed to POST /api/v1/namespaces/monitoring/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query_range for clusterId=0f96f2b596cd0d0f94565a1c74aa0ac2: Unprocessable Entity\n' +
[ 11] ' at /opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:31636:23\n' +
[ 12] ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
[ 13] ' at async loadMetricHelper (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35822:28)\n' +
[ 14] ' at async Promise.all (index 0)\n' +
[ 15] ' at async /opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35874:36\n' +
[ 16] ' at async Object.route (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:34859:32)\n' +
[ 17] ' at async Router.route (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:35090:9)\n' +
[ 18] ' at async LensProxy.handleRequest (/opt/Lens/resources/app.asar/node_modules/@lensapp/core/static/build/library/main.js:33367:13)'
[ 19] Cause:
[ 20] {
[ 21] size: 0,
[ 22] type: 'default',
[ 23] url: 'https://127.0.0.1:39221/0f96f2b596cd0d0f94565a1c74aa0ac2/api/v1/namespaces/monitoring/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query_range',
[ 24] status: 422,
[ 25] ok: false,
[ 26] redirected: false,
[ 27] statusText: 'Unprocessable Entity',
[ 28] headers: {
[ 29] 'audit-id': '7e946bbb-c548-404e-909d-8154af83971a',
[ 30] 'cache-control': 'no-cache, private',
[ 31] connection: 'close',
[ 32] 'content-encoding': 'gzip',
[ 33] 'content-length': '507',
[ 34] 'content-type': 'application/json',
[ 35] date: 'Thu, 31 Aug 2023 14:30:19 GMT'
[ 36] },
[ 37] clone: [Function: clone],
[ 38] body: <ref *1> Gunzip {
[ 39] _writeState: Uint32Array(2) [ 0, 0 ],
[ 40] _readableState: ReadableState {
[ 41] objectMode: false,
[ 42] highWaterMark: 16384,
[ 43] buffer: BufferList { head: null, tail: null, length: 0 },
[ 44] length: 0,
[ 45] pipes: [],
[ 46] flowing: null,
[ 47] ended: false,
[ 48] endEmitted: false,
[ 49] reading: false,
[ 50] constructed: true,
[ 51] sync: false,
[ 52] needReadable: false,
[ 53] emittedReadable: false,
[ 54] readableListening: false,
[ 55] resumeScheduled: false,
[ 56] errorEmitted: false,
[ 57] emitClose: true,
[ 58] autoDestroy: true,
[ 59] destroyed: false,
[ 60] errored: null,
[ 61] closed: false,
[ 62] closeEmitted: false,
[ 63] defaultEncoding: 'utf8',
[ 64] awaitDrainWriters: null,
[ 65] multiAwaitDrain: false,
[ 66] readingMore: false,
[ 67] dataEmitted: false,
[ 68] decoder: null,
[ 69] encoding: null,
[ 70] [Symbol(kPaused)]: null
[ 71] },
[ 72] _events: [Object: null prototype] {
[ 73] prefinish: [Function: prefinish],
[ 74] close: [ [Function (anonymous)], [Function: onclose], [Function (anonymous)], [Function: onclose] ],
[ 75] end: [ [Function: onend], [Function: onend] ],
[ 76] finish: [ [Function: onfinish], [Function: onfinish] ],
[ 77] error: [ [Function: onerror], [Function: onError], [Function: onerror], [Function (anonymous)] ]
[ 78] },
[ 79] _eventsCount: 5,
[ 80] _maxListeners: undefined,
[ 81] _writableState: WritableState {
[ 82] objectMode: false,
[ 83] highWaterMark: 16384,
[ 84] finalCalled: false,
[ 85] needDrain: false,
[ 86] ending: true,
[ 87] ended: true,
[ 88] finished: false,
[ 89] destroyed: false,
[ 90] decodeStrings: true,
[ 91] defaultEncoding: 'utf8',
[ 92] length: 507,
[ 93] writing: true,
[ 94] corked: 0,
[ 95] sync: false,
[ 96] bufferProcessing: false,
[ 97] onwrite: [Function: bound onwrite],
[ 98] writecb: [Function: nop],
[ 99] writelen: 507,
[100] afterWriteTickInfo: null,
[101] buffered: [],
[102] bufferedIndex: 0,
[103] allBuffers: true,
[104] allNoop: true,
[105] pendingcb: 1,
[106] constructed: true,
[107] prefinished: false,
[108] errorEmitted: false,
[109] emitClose: true,
[110] autoDestroy: true,
[111] errored: null,
[112] closed: false,
[113] closeEmitted: false,
[114] [Symbol(kOnFinished)]: []
[115] },
[116] allowHalfOpen: true,
[117] bytesWritten: 0,
[118] _handle: Zlib {
[119] onerror: [Function: zlibOnError],
[120] buffer: <Buffer 1f 8b 08 00 00 00 00 00 00 ff d4 94 d1 6e dc 2a 10 86 5f 05 71 1d 2c db 67 b3 eb dd 23 df f5 0d da bb ba b2 30 8c 6d ba f6 0c 85 61 93 34 ca bb 57 6c ... 457 more bytes>,
[121] cb: [Function (anonymous)],
[122] availOutBefore: 16384,
[123] availInBefore: 507,
[124] inOff: 0,
[125] flushFlag: 2,
[126] [Symbol(owner_symbol)]: [Circular *1]
[127] },
[128] _outBuffer: <Buffer 7b 22 73 74 61 74 75 73 22 3a 22 65 72 72 6f 72 22 2c 22 65 72 72 6f 72 54 79 70 65 22 3a 22 65 78 65 63 75 74 69 6f 6e 22 2c 22 65 72 72 6f 72 22 3a ... 16334 more bytes>,
[129] _outOffset: 0,
[130] _chunkSize: 16384,
[131] _defaultFlushFlag: 2,
[132] _finishFlushFlag: 2,
[133] _defaultFullFlushFlag: 3,
[134] _info: undefined,
[135] _maxOutputLength: 4294967296,
[136] _level: -1,
[137] _strategy: 0,
[138] [Symbol(kCapture)]: false,
[139] [Symbol(kCallback)]: null,
[140] [Symbol(kError)]: null
[141] },
[142] bodyUsed: false,
[143] arrayBuffer: [AsyncFunction: arrayBuffer],
[144] blob: [AsyncFunction: blob],
[145] json: [AsyncFunction: json],
[146] text: [AsyncFunction: text],
[147] [Symbol(Body internals)]: {
[148] body: <ref *1> Gunzip {
[149] _writeState: Uint32Array(2) [ 0, 0 ],
[150] _readableState: ReadableState {
[151] objectMode: false,
[152] highWaterMark: 16384,
[153] buffer: BufferList { head: null, tail: null, length: 0 },
[154] length: 0,
[155] pipes: [],
[156] flowing: null,
[157] ended: false,
[158] endEmitted: false,
[159] reading: false,
[160] constructed: true,
[161] sync: false,
[162] needReadable: false,
[163] emittedReadable: false,
[164] readableListening: false,
[165] resumeScheduled: false,
[166] errorEmitted: false,
[167] emitClose: true,
[168] autoDestroy: true,
[169] destroyed: false,
[170] errored: null,
[171] closed: false,
[172] closeEmitted: false,
[173] defaultEncoding: 'utf8',
[174] awaitDrainWriters: null,
[175] multiAwaitDrain: false,
[176] readingMore: false,
[177] dataEmitted: false,
[178] decoder: null,
[179] encoding: null,
[180] [Symbol(kPaused)]: null
[181] },
[182] _events: [Object: null prototype] {
[183] prefinish: [Function: prefinish],
[184] close: [ [Function (anonymous)], [Function: onclose], [Function (anonymous)], [Function: onclose] ],
[185] end: [ [Function: onend], [Function: onend] ],
[186] finish: [ [Function: onfinish], [Function: onfinish] ],
[187] error: [ [Function: onerror], [Function: onError], [Function: onerror], [Function (anonymous)] ]
[188] },
[189] _eventsCount: 5,
[190] _maxListeners: undefined,
[191] _writableState: WritableState {
[192] objectMode: false,
[193] highWaterMark: 16384,
[194] finalCalled: false,
[195] needDrain: false,
[196] ending: true,
[197] ended: true,
[198] finished: false,
[199] destroyed: false,
[200] decodeStrings: true,
[201] defaultEncoding: 'utf8',
[202] length: 507,
[203] writing: true,
[204] corked: 0,
[205] sync: false,
[206] bufferProcessing: false,
[207] onwrite: [Function: bound onwrite],
[208] writecb: [Function: nop],
[209] writelen: 507,
[210] afterWriteTickInfo: null,
[211] buffered: [],
[212] bufferedIndex: 0,
[213] allBuffers: true,
[214] allNoop: true,
[215] pendingcb: 1,
[216] constructed: true,
[217] prefinished: false,
[218] errorEmitted: false,
[219] emitClose: true,
[220] autoDestroy: true,
[221] errored: null,
[222] closed: false,
[223] closeEmitted: false,
[224] [Symbol(kOnFinished)]: []
[225] },
[226] allowHalfOpen: true,
[227] bytesWritten: 0,
[228] _handle: Zlib {
[229] onerror: [Function: zlibOnError],
[230] buffer: <Buffer 1f 8b 08 00 00 00 00 00 00 ff d4 94 d1 6e dc 2a 10 86 5f 05 71 1d 2c db 67 b3 eb dd 23 df f5 0d da bb ba b2 30 8c 6d ba f6 0c 85 61 93 34 ca bb 57 6c ... 457 more bytes>,
[231] cb: [Function (anonymous)],
[232] availOutBefore: 16384,
[233] availInBefore: 507,
[234] inOff: 0,
[235] flushFlag: 2,
[236] [Symbol(owner_symbol)]: [Circular *1]
[237] },
[238] _outBuffer: <Buffer 7b 22 73 74 61 74 75 73 22 3a 22 65 72 72 6f 72 22 2c 22 65 72 72 6f 72 54 79 70 65 22 3a 22 65 78 65 63 75 74 69 6f 6e 22 2c 22 65 72 72 6f 72 22 3a ... 16334 more bytes>,
[239] _outOffset: 0,
[240] _chunkSize: 16384,
[241] _defaultFlushFlag: 2,
[242] _finishFlushFlag: 2,
[243] _defaultFullFlushFlag: 3,
[244] _info: undefined,
[245] _maxOutputLength: 4294967296,
[246] _level: -1,
[247] _strategy: 0,
[248] [Symbol(kCapture)]: false,
[249] [Symbol(kCallback)]: null,
[250] [Symbol(kError)]: null
[251] },
[252] stream: <ref *1> Gunzip {
[253] _writeState: Uint32Array(2) [ 0, 0 ],
[254] _readableState: ReadableState {
[255] objectMode: false,
[256] highWaterMark: 16384,
[257] buffer: BufferList { head: null, tail: null, length: 0 },
[258] length: 0,
[259] pipes: [],
[260] flowing: null,
[261] ended: false,
[262] endEmitted: false,
[263] reading: false,
[264] constructed: true,
[265] sync: false,
[266] needReadable: false,
[267] emittedReadable: false,
[268] readableListening: false,
[269] resumeScheduled: false,
[270] errorEmitted: false,
[271] emitClose: true,
[272] autoDestroy: true,
[273] destroyed: false,
[274] errored: null,
[275] closed: false,
[276] closeEmitted: false,
[277] defaultEncoding: 'utf8',
[278] awaitDrainWriters: null,
[279] multiAwaitDrain: false,
[280] readingMore: false,
[281] dataEmitted: false,
[282] decoder: null,
[283] encoding: null,
[284] [Symbol(kPaused)]: null
[285] },
[286] _events: [Object: null prototype] {
[287] prefinish: [Function: prefinish],
[288] close: [ [Function (anonymous)], [Function: onclose], [Function (anonymous)], [Function: onclose] ],
[289] end: [ [Function: onend], [Function: onend] ],
[290] finish: [ [Function: onfinish], [Function: onfinish] ],
[291] error: [ [Function: onerror], [Function: onError], [Function: onerror], [Function (anonymous)] ]
[292] },
[293] _eventsCount: 5,
[294] _maxListeners: undefined,
[295] _writableState: WritableState {
[296] objectMode: false,
[297] highWaterMark: 16384,
[298] finalCalled: false,
[299] needDrain: false,
[300] ending: true,
[301] ended: true,
[302] finished: false,
[303] destroyed: false,
[304] decodeStrings: true,
[305] defaultEncoding: 'utf8',
[306] length: 507,
[307] writing: true,
[308] corked: 0,
[309] sync: false,
[310] bufferProcessing: false,
[311] onwrite: [Function: bound onwrite],
[312] writecb: [Function: nop],
[313] writelen: 507,
[314] afterWriteTickInfo: null,
[315] buffered: [],
[316] bufferedIndex: 0,
[317] allBuffers: true,
[318] allNoop: true,
[319] pendingcb: 1,
[320] constructed: true,
[321] prefinished: false,
[322] errorEmitted: false,
[323] emitClose: true,
[324] autoDestroy: true,
[325] errored: null,
[326] closed: false,
[327] closeEmitted: false,
[328] [Symbol(kOnFinished)]: []
[329] },
[330] allowHalfOpen: true,
[331] bytesWritten: 0,
[332] _handle: Zlib {
[333] onerror: [Function: zlibOnError],
[334] buffer: <Buffer 1f 8b 08 00 00 00 00 00 00 ff d4 94 d1 6e dc 2a 10 86 5f 05 71 1d 2c db 67 b3 eb dd 23 df f5 0d da bb ba b2 30 8c 6d ba f6 0c 85 61 93 34 ca bb 57 6c ... 457 more bytes>,
[335] cb: [Function (anonymous)],
[336] availOutBefore: 16384,
[337] availInBefore: 507,
[338] inOff: 0,
[339] flushFlag: 2,
[340] [Symbol(owner_symbol)]: [Circular *1]
[341] },
[342] _outBuffer: <Buffer 7b 22 73 74 61 74 75 73 22 3a 22 65 72 72 6f 72 22 2c 22 65 72 72 6f 72 54 79 70 65 22 3a 22 65 78 65 63 75 74 69 6f 6e 22 2c 22 65 72 72 6f 72 22 3a ... 16334 more bytes>,
[343] _outOffset: 0,
[344] _chunkSize: 16384,
[345] _defaultFlushFlag: 2,
[346] _finishFlushFlag: 2,
[347] _defaultFullFlushFlag: 3,
[348] _info: undefined,
[349] _maxOutputLength: 4294967296,
[350] _level: -1,
[351] _strategy: 0,
[352] [Symbol(kCapture)]: false,
[353] [Symbol(kCallback)]: null,
[354] [Symbol(kError)]: null
[355] },
[356] boundary: null,
[357] disturbed: false,
[358] error: null
[359] },
[360] [Symbol(Response internals)]: {
[361] type: 'default',
[362] url: 'https://127.0.0.1:39221/0f96f2b596cd0d0f94565a1c74aa0ac2/api/v1/namespaces/monitoring/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query_range',
[363] status: 422,
[364] statusText: 'Unprocessable Entity',
[365] headers: {
[366] 'audit-id': '7e946bbb-c548-404e-909d-8154af83971a',
[367] 'cache-control': 'no-cache, private',
[368] connection: 'close',
[369] 'content-encoding': 'gzip',
[370] 'content-length': '507',
[371] 'content-type': 'application/json',
[372] date: 'Thu, 31 Aug 2023 14:30:19 GMT'
[373] },
[374] counter: 0,
[375] highWaterMark: 16384
[376] }
[377] }
Kubeconfig: // Please, don't ask me about that :)
Additional context I have same issue on two different clusters with different versions of kube-prometheus-stack installed.
Same problem here on all our GKE clusters
We have the same problem on EKS clusters
I fixed my problem by on EKS and GKE by making sure the SecurityGroup/Firewall from the managed master could communicate with the worker nodes on port 9090. I had a rule that blocked this port.