Disable the etcd3 client logger

This logger is responsible for 20% of the API server's memory usage when
many CRDs are installed. See the below issue for more context.

https://github.com/kubernetes/kubernetes/issues/111476

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: 0e5401c93940126beac45264aa056507b0950075
This commit is contained in:
Nic Cope 2022-07-27 14:44:49 -07:00 committed by Kubernetes Publisher
parent 1d04de9505
commit ef17269e10
1 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import (
"go.etcd.io/etcd/client/pkg/v3/transport"
clientv3 "go.etcd.io/etcd/client/v3"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.uber.org/zap"
"google.golang.org/grpc"
"k8s.io/apimachinery/pkg/runtime"
@ -223,6 +224,10 @@ var newETCD3Client = func(c storagebackend.TransportConfig) (*clientv3.Client, e
DialOptions: dialOptions,
Endpoints: c.ServerList,
TLS: tlsConfig,
// This logger uses a significant amount of memory when many CRDs (i.e.
// 1,000+) are added to the API server, so we disable it.
Logger: zap.NewNop(),
}
return clientv3.New(cfg)