diff --git a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go index 2f2195134..5955a684c 100644 --- a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go +++ b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go @@ -164,6 +164,13 @@ func (c *DynamicFileCAContent) Run(ctx context.Context, workers int) { // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, ctx.Done()) + // Reload the client CA on a timer. MCO replaces kubelet-ca.crt with a new + // inode, so a filesystem watch on the old inode never fires and scrapes + // keep failing with HTTP 401 until the process restarts. + go wait.Until(func() { + c.queue.Add(workItemKey) + }, FileRefreshDuration, ctx.Done()) + // start the loop that watches the CA file until stopCh is closed. go wait.Until(func() { if err := c.watchCAFile(ctx.Done()); err != nil { diff --git a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go index 268fe70b0..26985fee2 100644 --- a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go +++ b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go @@ -138,6 +138,11 @@ func (c *DynamicCertKeyPairContent) Run(ctx context.Context, workers int) { // doesn't matter what workers say, only start one. go wait.Until(c.runWorker, time.Second, ctx.Done()) + // Reload cert/key files on a timer. Same inode-replace case as the client CA. + go wait.Until(func() { + c.queue.Add(workItemKey) + }, FileRefreshDuration, ctx.Done()) + // start the loop that watches the cert and key files until stopCh is closed. go wait.Until(func() { if err := c.watchCertKeyFile(ctx.Done()); err != nil {