kubelet: silence flag output on errors (#110728)

* kubelet: silence flag output on errors

Currently, the `--help` text is output on kubelet errors. Currently on
my machine this is 280 lines. Typically kubelet is run by systemd or
similar, starting it a loop. This means when an issue is encountered, we
are spammed by 100s of logs per second, masking the real error.

With this PR, the list of all flags is silenced. Users can still access
them by `kubelet --help` as normal. This same `SilenceUsage` is already
set in the api-server command.

* Update cmd/kubelet/app/server.go

Co-authored-by: Paco Xu <paco.xu@daocloud.io>

Co-authored-by: Paco Xu <paco.xu@daocloud.io>
This commit is contained in:
John Howard 2022-06-27 18:34:59 +00:00 committed by GitHub
parent 10810ab42b
commit c6b0652b89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,6 +157,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
// DisableFlagParsing=true provides the full set of flags passed to the kubelet in the
// `args` arg to Run, without Cobra's interference.
DisableFlagParsing: true,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
// initial flag parse, since we disable cobra's flag parsing
if err := cleanFlagSet.Parse(args); err != nil {