Change:
When starting the Kubelet with , the Kubelet begins with unstructured logging and then transitions to structured logging: I expect the Kubelet to have structured logging through the startup lifecycle. Kubernetes version (use ): master [] Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Network plugin and version (if this is a network-related bug): Others:
/triage accepted /sig node
Is it possible that these components are not yet migrated? I don't think or are on structured logging yet.
/cc
It's true tha and and is not yet log structured, At least I don't see it in the PR that exists
This bug is related to JSON implementation, not structured logging. Moment that logging format configuration is applied happens late in component bootstrap process. (EDIT: changed the "Configuration of JSON" to "Moment that logging format configuration is applied")
If so, is it related to this PR ? This PR changes the from component-base/logs to the component-base/config
No, your PR is not related. As a configuration of JSON I meant the moment the configuration is applied and klog switches to use different format. This is done exactly when particular component calls . Fixing this issue should be done by changing component bootstrap process in a way that prioritizes configuring logging over any other configuration.
Thanks, I get it
/assign
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-contributor-experience at . /lifecycle stale
/remove-lifecycle stale
/milestone v1.22
/sig instrumentation /wg structured-logging
Hey there ( Bug-Triage here , Given the fact that the code freeze for this release already started, I´d like to suggest moving this issue to the next milestone. wdyt?
Due to v1.22 code freeze, I'm moving this issue to the next release. /milestone v1.23
This needs to be fixed in kubelet. Those log messages that occur in text format should be moved to a point during init where logging is initialized.
Hey there ( Bug-Triage here , Just want to make sure this issue is still on track for the 1.23?
Hey what's the current status of init logs after your recent improvements? Is there anything left to do here?
No, this is not fixed. is still being called before . The behavior is a bit different, though: while previously it used the wrong default log format, now it uses the wrong default log level and therefore those messages are not printed. I'd also like to clarify one thing: the "Flag ... has been deprecated, will be removed in a future version" messages are printed by pflag to stderr. Those are not normal log messages and no matter what we do with logging, they will always be plain text.
The fix is easy. Whether there's anyone willing to approve a PR is a different question...
/milestone v1.24
We can still fix this in 1.23. PR is here:

Discussion:
// short-circuit on verflag verflag.PrintAndExitIfRequested() <del> cliflag.PrintFlags(cleanFlagSet) </del> // set feature gates from initial flags-based config if err := utilfeature.DefaultMutableFeatureGate.SetFromMap(kubeletConfig.FeatureGates); err != nil {

klog.ErrorS(err, "Failed to initialize logging") os.Exit(1) } <ins> cliflag.PrintFlags(cleanFlagSet) </ins> // construct a KubeletServer from kubeletFlags and kubeletConfig kubeletServer := &options.KubeletServer{