Code change:
When we want to rotate certificates for aggregated API servers, we have to restart (kill) pods in order for API server to pick the new certificates. It would be very useful to implement some sort of self-awareness for the aggregated API servers, so they can pick-up new certificates when they're updated, without user interaction. If we have certificate files in pods, that are provided by some volumeSource, that can be persistent storage or a Secret, when file gets changed on the volume, the kubelet updates file in the pod usually in matters of few seconds. However, aggregated API servers are not self-aware of such change and users have to manually restart the pods. This brings additional complexity, especially if you want to automate the process. The first problem is that you need to know what pods you need to restart. But the potentially biggest problem is that you need additional permissions to do so. That would include RBAC permissions for listing pods, listing deployments and for deleting pods. That can make a security issue in some setups. By making aggregated API servers sort of self-aware, this could be avoided. Create a health check somewhere in , that utilizes a file watcher to watch for certificates changes. When certificate is changed, fail a health check. Failing health check will restart the pod without user interaction. This could be the most easiest and simplest solution to the problem. Such feature should/could be optional and guarded by a flag, let's name it . Some delay could be required between restarting pods. We probably don't want to kill all pods in the same time. This is up to be discussed. I would like to work on this issue, so feel free to assign it to me. /kind feature /sig api-machinery /area apiserver /cc
this could also be done by a purpose-built container that watched the same input files. as you point out, you likely would not want to restart all apiservers at once, which makes it unclear whether you'd want to build in the restart logic to the individual servers
That coordination would certainly work and be a valuable tool for someone to build to help manage rolling generic processes if we never get a pod restart. However, being able to have a "usually won't all go down together" option built-in is easy to understand and will resolve the problem until then. It isn't a stretch to say that if your process isn't fulfilling the current intent of the pod, it isn't healthy. This gives us a thing between dynamic config reloading and nothing. A container that can coordinate based on a service would be really cool, but I think that'd be a separate thing.
/cc
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
/remove-lifecycle stale
/remove-lifecycle stale
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
/remove-lifecycle stale
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
Stale issues rot after 30d of inactivity. Mark the issue as fresh with . Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle rotten
Rotten issues close after 30d of inactivity. Reopen the issue with . Mark the issue as fresh with . Send feedback to sig-testing, kubernetes/test-infra and/or . /close
Closing this issue. <detailsIn response to : Rotten issues close after 30d of inactivity. Reopen the issue with . Mark the issue as fresh with . /close Instructions 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

Related discussion:
text: } } } <ins> func TestSNICert(t *testing.T) { stopCh := make(chan struct{}) defer close(stopCh) var servingCertPath string _, kubeconfig := framework.StartTestServer(t, stopCh, framework.TestServerSetup{ ModifyServerRunOptions: func(opts *options.ServerRunOptions) { opts.GenericServerRunOptions.MaxRequestBodyBytes = 1024 * 1024 servingCertPath = opts.SecureServing.ServerCert.CertDirectory if err := ioutil.WriteFile(path.Join(servingCertPath, "foo.key"), anotherServerKey, 0644); err != nil { t.Fatal(err) } if err := ioutil.WriteFile(path.Join(servingCertPath, "foo.crt"), anotherServerCert, 0644); err != nil { t.Fatal(err) } dynamiccertificates.FileRefreshDuration = 1 * time.Second opts.SecureServing.SNICertKeys = []flag.NamedCertKey{{ Names:    []string{"foo"}, CertFile: path.Join(servingCertPath, "foo.crt"), KeyFile:  path.Join(servingCertPath, "foo.key"), }} }, }) apiserverURL, err := url.Parse(kubeconfig.Host) if err != nil { t.Fatal(err) } // When we run this the second time, we know which one we are expecting. acceptableCerts := [][]byte{} tlsConfig := &tls.Config{ InsecureSkipVerify: true, VerifyPeerCertificate: func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error { acceptableCerts = make([][]byte, 0, len(rawCerts)) for _, r := range rawCerts { acceptableCerts = append(acceptableCerts, r) } return nil }, ServerName: "foo", } conn, err := tls.Dial("tcp", apiserverURL.Host, tlsConfig) if err != nil { t.Fatal(err) } conn.Close() cert, err := tls.LoadX509KeyPair(path.Join(servingCertPath, "foo.crt"), path.Join(servingCertPath, "foo.key")) if err != nil { t.Fatal(err) } expectedCerts := cert.Certificate if len(expectedCerts) != len(acceptableCerts) { var certs []string for _, a := range acceptableCerts { certs = append(certs, base64.StdEncoding.EncodeToString(a)) } t.Fatalf("Unexpected number of certs: %v", strings.Join(certs, ":")) } for i := range expectedCerts { if !bytes.Equal(acceptableCerts[i], expectedCerts[i]) { t.Errorf("expected %q, got %q", base64.StdEncoding.EncodeToString(expectedCerts[i]), base64.StdEncoding.EncodeToString(acceptableCerts[i])) } } if err := ioutil.WriteFile(path.Join(servingCertPath, "foo.key"), serverKey, 0644); err != nil { t.Fatal(err) } if err := ioutil.WriteFile(path.Join(servingCertPath, "foo.crt"), serverCert, 0644); err != nil { t.Fatal(err) } time.Sleep(4 * time.Second) conn2, err := tls.Dial("tcp", apiserverURL.Host, tlsConfig) if err != nil { t.Fatal(err) } conn2.Close() cert, err = tls.X509KeyPair(serverCert, serverKey) if err != nil { t.Fatal(err) } expectedCerts = cert.Certificate if len(expectedCerts) != len(acceptableCerts) { var certs []string for _, a := range acceptableCerts { certs = append(certs, base64.StdEncoding.EncodeToString(a)) } t.Fatalf("Unexpected number of certs: %v", strings.Join(certs, ":")) } for i := range expectedCerts { if !bytes.Equal(acceptableCerts[i], expectedCerts[i]) { t.Errorf("expected %q, got %q", base64.StdEncoding.EncodeToString(expectedCerts[i]), base64.StdEncoding.EncodeToString(acceptableCerts[i])) } } } </ins>