Check if the process is running inside a kubernetes container
$ npm install is-kubernetes
const isKubernetes = require('is-kubernetes');
if (isKubernetes()) {
console.log('Running inside a kubernetes container');
}
$ npx is-kubernetes
Exits with code 0 if inside a kubernetes container and 1 if not.