diff --git a/cmd/root.go b/cmd/root.go index 858cf6a6..3c5fe14c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -38,6 +38,11 @@ func init() { rootCmd.PersistentFlags().StringVarP(&kubeconfig, "kubeconfig", "", "$HOME/.kube/config", "Kubeconfig location.") klog.InitFlags(nil) + // Opt into the new klog behavior so that -stderrthreshold is honored even + // when -logtostderr=true (the default). + // Ref: kubernetes/klog#212, kubernetes/klog#432 + flag.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck + flag.Set("stderrthreshold", "INFO") //nolint:errcheck pflag.CommandLine.AddGoFlag(flag.CommandLine.Lookup("v")) environmentVariables := map[string]string{