Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
3 contributors

Users who have contributed to this file

@hardillb @Legion2 @brendanburns
const stream = require('stream');
const k8s = require('@kubernetes/client-node');
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const log = new k8s.Log(kc);
const logStream = new stream.PassThrough();
logStream.on('data', (chunk) => {
// use write rather than console.log to prevent double line feed
process.stdout.write(chunk);
});
log.log('default', 'pod1', 'container', logStream, {follow: true, tailLines: 50, pretty: false, timestamps: false})
.catch(err => {
console.log(err);
process.exit(1);
})
.then(req => {
// disconnects after 5 seconds
if (req) {
setTimeout(function(){
req.abort();
}, 5000);
}
});