Issue
We are using a node js application along with Kubernetes with auto-scaling. My requirement is to log a few things wrt the current instance (pod, IP or anything unique for that instance).
Is there any way in the node js and typescript to get such identifiers in the backend application?
Solution
The hostname will contain the unique (per namespace) pod name. So just get the current hostname of the backend and you have a unique identifier.
For example
const os = require("os");
const hostName = os.hostname();
Answered By - Thomas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.