Giter Site home page Giter Site logo

Comments (6)

16Bitt avatar 16Bitt commented on August 19, 2024 1

Great suggestions! Thank you so much for your input!

Here's a PR that allows setting the logfile along with updated documentation: #2

It also fixes a really dumb bug on my part, as I was assuming that sysinfo accounted for cgroups

from kubemem.

16Bitt avatar 16Bitt commented on August 19, 2024

Hi there! Thanks for pointing this out! I’ve primarily been using the logs for debugging the tool, but I had assumed the probe logs would show within the pod logs.

I’ll put together an option to manually create the event through the REST API, which may add a bit more complexity but would certain be worth the investment.

As for the logging infrastructure we us at $work, we use Sumologic-fluentd to aggregate pod and API server logs. A significant drawback to this is bumping up verbosity even one level in the cluster can rack up your bills super quickly, so I’d rather not burden users with a verbosity increase. Adding audit logging to our clusters added 2Gi a day in sumo logic.

I haven’t rolled this out in prod yet (I wrote this on my vacation) but I’m very certain a lot of changes will happen as I start to use this in production worker pods. Unfortunately my company doesn’t allow open source contributions, so this will have to be done after hours once I’m back in the office.

from kubemem.

stealthybox avatar stealthybox commented on August 19, 2024

Appending to PID 1 stdout might work:

echo warning >> /proc/1/fd/1

It's worth testing in a Pod to see.

That might be a sensible default behavior in a Pod, or it could be opt-in and showed in the example.
It should be possible to disable as it relies on the probe having write access.

A more generic flag might work too:

--log-file=/proc/1/fd/1  # append to PID 1 stdout

from kubemem.

stealthybox avatar stealthybox commented on August 19, 2024

I tested the idea with a basic shell script and an exec, and it seems to work:

terminal 1

# Start a pod that prints some numbers
kubectl run testpid1 --image busybox -- sh -c 'for i in $(seq 1 3600); do sleep 1; echo $i; done'
kubectl logs -f deploy/testpid1

terminal 2

# Run a separate process in that pod that appends to the pod log once
k exec -it deploy/testpid1 -- sh -c 'echo helloworld >> /proc/1/fd/1'

This seems simpler than creating Events.
The program can keep logging to both places so that the Failure Events still have logs.

from kubemem.

16Bitt avatar 16Bitt commented on August 19, 2024

Forgot to close this!

from kubemem.

darioleanbit avatar darioleanbit commented on August 19, 2024

Hi @16Bitt , if I try to do

# echo warning >> /proc/1/fd/1
bash: /proc/1/fd/1: Permission denied

I get this error, is there any workaround? Thanks!

from kubemem.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.