How to use single signon of nodejs app using kubernetes deployment?

Uday Kiran Reddy (ureddy) 96 Reputation points
2023-09-12T06:37:05.9133333+00:00

I have tried setting up single signon on a sample nodejs app with express and microsoft authentication.

This is the steps and source code [link][1]

When I run locally, it is working.

When I kept in kubernetes and access directly using loadbanacer service ip, it is working.

But, when I deployed a k3s vm in azure ubuntu machine and kept azure app gateway in same network and configured traffic to route to this load balancer ip,

It is going to the signin page.

[webpage loaded][2]

But when I click on signin button, it is giving 502 gateway error.

[502 error][3]

When I click on refresh, then error is coming in log.

This is the pod log when that error came.

> onocspresponse: [Function: onocspresponse],

> onnewsession: [Function: onnewsessionclient],

> onerror: [Function: onerror],

> [Symbol(owner_symbol)]: [Circular *1]

> },

> _requestCert: true,

> _rejectUnauthorized: true,

> parser: null,

> _httpMessage: [Circular *2],

> [Symbol(res)]: TLSWrap {

> _parent: TCP {

> reading: [Getter/Setter],

> onconnection: null,

> [Symbol(owner_symbol)]: [Circular *1]

> },

> _parentWrap: undefined,

> _secureContext: SecureContext { context: SecureContext {} },

> reading: true,

> onkeylog: [Function: onkeylog],

> onhandshakestart: {},

> onhandshakedone: [Function (anonymous)],

> onocspresponse: [Function: onocspresponse],

> onnewsession: [Function: onnewsessionclient],

> onerror: [Function: onerror],

> [Symbol(owner_symbol)]: [Circular *1]

> },

> [Symbol(verified)]: true,

> [Symbol(pendingSession)]: null,

> [Symbol(async_id_symbol)]: 76,

> [Symbol(kHandle)]: TLSWrap {

> _parent: TCP {

> reading: [Getter/Setter],

> onconnection: null,

> [Symbol(owner_symbol)]: [Circular *1]

> },

> _parentWrap: undefined,

> _secureContext: SecureContext { context: SecureContext {} },

> reading: true,

> onkeylog: [Function: onkeylog],

> onhandshakestart: {},

> onhandshakedone: [Function (anonymous)],

> onocspresponse: [Function: onocspresponse],

> onnewsession: [Function: onnewsessionclient],

> onerror: [Function: onerror],

> [Symbol(owner_symbol)]: [Circular *1]

> },

> [Symbol(lastWriteQueueSize)]: 0,

> [Symbol(timeout)]: null,

> [Symbol(kBuffer)]: null,

> [Symbol(kBufferCb)]: null,

> [Symbol(kBufferGen)]: null,

> [Symbol(kCapture)]: false,

> [Symbol(kSetNoDelay)]: false,

> [Symbol(kSetKeepAlive)]: true,

> [Symbol(kSetKeepAliveInitialDelay)]: 60,

> [Symbol(kBytesRead)]: 0,

> [Symbol(kBytesWritten)]: 0,

> [Symbol(connect-options)]: {

> rejectUnauthorized: true,

> ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',

> checkServerIdentity: [Function: checkServerIdentity],

> minDHSize: 1024,

> maxRedirects: 21,

> maxBodyLength: Infinity,

> protocol: 'https:',

> path: null,

> method: 'GET',

> headers: [Object: null prototype] { To bottom Logs from 9/12/2023, 11:19:18 AM

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,213 questions
Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,447 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.