Kubernetes for Developers
上QQ阅读APP看书,第一时间看更新

Getting logs from your application

Just like the Python example, the Node.js example sends some output to STDOUT. As the containers are specifically set up to capture any output to STDOUT and STDERR from the executable you've specified and capture that into logs, the same commands will work to show you the log output from the Node.js application:

kubectl logs nodejs-568183341-2bw5v

This should show you output akin to the following:

> kfd-nodejs@0.0.0 start /src
> node ./bin/www
Sat, 16 Sep 2017 10:06:41 GMT kfd-nodejs:server Listening on port 3000
GET / 304 305.615 ms - -
GET /favicon.ico 404 54.056 ms - 855
GET /stylesheets/style.css 200 63.234 ms - 111
GET / 200 48.033 ms - 170
GET /stylesheets/style.css 200 1.373 ms - 111