Explicitly shutting down background flushing addresses the following data race:
WARNING: DATA RACE
Write at 0x0000091173b8 by goroutine 166:
k8s.io/component-base/logs/api/v1.apply.FlushLogger.func2()
/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/contextual.go:95 +0x35
k8s.io/klog/v2.SetLoggerWithOptions()
/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/contextual.go:75 +0xb4
k8s.io/component-base/logs/api/v1.apply()
/nvme/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/component-base/logs/api/v1/options.go:277 +0x10fb
k8s.io/component-base/logs/api/v1.validateAndApply()
/nvme/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/component-base/logs/api/v1/options.go:132 +0x90
k8s.io/component-base/logs/api/v1.ValidateAndApply()
/nvme/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/component-base/logs/api/v1/options.go:94 +0xd4
k8s.io/component-base/logs/api/v1.ResetForTest()
/nvme/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/component-base/logs/api/v1/options.go:314 +0xd5
k8s.io/kubernetes/test/integration/scheduler_perf.setupTestCase.func1()
/nvme/gopath/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf.go:1062 +0x95
testing.(*common).Cleanup.func1()
/nvme/gopath/go-1.24.0/src/testing/testing.go:1211 +0x16f
testing.(*common).runCleanup()
/nvme/gopath/go-1.24.0/src/testing/testing.go:1445 +0x2b3
testing.(*common).runCleanup()
/nvme/gopath/go-1.24.0/src/testing/testing.go:1445 +0x2b3
testing.tRunner.func2()
/nvme/gopath/go-1.24.0/src/testing/testing.go:1786 +0x4c
runtime.deferreturn()
/nvme/gopath/go-1.24.0/src/runtime/panic.go:605 +0x5d
k8s.io/apiserver/pkg/endpoints.(*APIInstaller).Install()
/nvme/gopath/src/k8s.io/kubernetes/staging/src/k8s.io/apiserver/pkg/endpoints/installer.go:208 +0x3ad
...
Previous read at 0x0000091173b8 by goroutine 169:
k8s.io/klog/v2.(*loggingT).flushAll()
/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:1215 +0x166
k8s.io/klog/v2.(*loggingT).lockAndFlushAll()
/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:1193 +0x58
k8s.io/klog/v2.(*loggingT).lockAndFlushAll-fm()
<autogenerated>:1 +0x33
k8s.io/klog/v2.(*flushDaemon).run.func1()
/nvme/gopath/src/k8s.io/kubernetes/vendor/k8s.io/klog/v2/klog.go:1143 +0x179
That the cleanup code is shown as being called by runtime/panic.go and
k8s.io/apiserver/pkg/endpoints/installer.go seems to be an oddity of `go test
-race`. Under a debugger it gets called normally, without a panic, and the test
finishes normally either way.
It's debatable whether StopFlushDaemon should be called by the caller of
ResetForTest or by ResetForTest itself. It's explicitly called out as "not
thread safe", so making the caller responsible seems appropriate.
Kubernetes (K8s)
Kubernetes, also known as K8s, is an open source system for managing containerized applications across multiple hosts. It provides basic mechanisms for the deployment, maintenance, and scaling of applications.
Kubernetes builds upon a decade and a half of experience at Google running production workloads at scale using a system called Borg, combined with best-of-breed ideas and practices from the community.
Kubernetes is hosted by the Cloud Native Computing Foundation (CNCF). If your company wants to help shape the evolution of technologies that are container-packaged, dynamically scheduled, and microservices-oriented, consider joining the CNCF. For details about who's involved and how Kubernetes plays a role, read the CNCF announcement.
To start using K8s
See our documentation on kubernetes.io.
Take a free course on Scalable Microservices with Kubernetes.
To use Kubernetes code as a library in other applications, see the list of published components.
Use of the k8s.io/kubernetes module or k8s.io/kubernetes/... packages as libraries is not supported.
To start developing K8s
The community repository hosts all information about building Kubernetes from source, how to contribute code and documentation, who to contact about what, etc.
If you want to build Kubernetes right away there are two options:
You have a working Go environment.
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make
You have a working Docker environment.
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
make quick-release
For the full story, head over to the developer's documentation.
Support
If you need support, start with the troubleshooting guide, and work your way through the process that we've outlined.
That said, if you have questions, reach out to us one way or another.
Community Meetings
The Calendar has the list of all the meetings in the Kubernetes community in a single location.
Adopters
The User Case Studies website has real-world use cases of organizations across industries that are deploying/migrating to Kubernetes.
Governance
Kubernetes project is governed by a framework of principles, values, policies and processes to help our community and constituents towards our shared goals.
The Kubernetes Community is the launching point for learning about how we organize ourselves.
The Kubernetes Steering community repo is used by the Kubernetes Steering Committee, which oversees governance of the Kubernetes project.
Roadmap
The Kubernetes Enhancements repo provides information about Kubernetes releases, as well as feature tracking and backlogs.