Change:
It looks like kubelet started using generic user agent like "Go-http-client/2.0" and makes it harder to attribute the request to kubelet. In the past we have used "kubelet" user-agent which was providing some value. Sample logs: Kubelet's requests are using customised user-agent Run kubelet Check kube-apiserver's logs: No response master tested on gce <details</details<details</details<details</details<details</details
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/sig node
The default user agent name is generated like below. I am using v1.23.4 and the user agent can show kubelet as the user agent.(not on gce)
/cc We should identify those and set the user-agent correctly , is right, it is very useful field ... but I see ~kubectl~ kubelet user-agents in the log linked
Interesting... in I see both kubelet user agent and "Go-http-client/2.0": Moreover, it looks like "kubelet" user agent is used only for events-related calls and other (like leases) are using "Go-http-client/2.0".
interesting , the user agent is to the request by wrapping the roundtripper, that is when the client is generated the clientset creation is here Speculating, I'm wondering if the updateTransport is mutating the transport and not adding the corresponding wrapper in ?
/assign I think that this was my fault, let me check it in more detail
I think that this was the problem

Discussion:
<ins> /* Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package kubernetes_test import ( "context" "net/http" "net/http/httptest" "testing" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" ) func TestClientUserAgent(t *testing.T) { tests := []struct { name      string userAgent string expect    string }{ { name:   "empty", expect: rest.DefaultKubernetesUserAgent(), }, { name:      "custom", userAgent: "test-agent", expect:    "test-agent", }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { userAgent := r.Header.Get("User-Agent") if userAgent != tc.expect { t.Errorf("User Agent expected: %s got: %s", tc.expect, userAgent) http.Error(w, "Unexpected user agent", http.StatusBadRequest) return } w.Header().Set("Content-Type", "application/json") w.Write([]byte("{}")) })) ts.Start() defer ts.Close() gv := v1.SchemeGroupVersion config := &rest.Config{ Host: ts.URL, } config.GroupVersion = &gv config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() config.UserAgent = tc.userAgent config.ContentType = "application/json" client, err := kubernetes.NewForConfig(config) if err != nil { t.Fatalf("failed to create REST client: %v", err) } _, err = client.CoreV1().Pods("").List(context.TODO(), metav1.ListOptions{}) if err != nil { t.Error(err) } _, err = client.CoreV1().Secrets("").List(context.TODO(), metav1.ListOptions{}) if err != nil { t.Error(err) } }) } } </ins>

func NewForConfig(c *$.Config|raw$) (*Clientset, error) { configShallowCopy := *c <ins> if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = $.DefaultKubernetesUserAgent|raw$() } </ins> // share the transport between all clients httpClient, err := $.RESTHTTPClientFor|raw$(&configShallowCopy) if err != nil {

func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c <ins> if configShallowCopy.UserAgent == "" { configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() } </ins> // share the transport between all clients httpClient, err := rest.HTTPClientFor(&configShallowCopy) if err != nil {