kubernetes: kubelet and kube-proxy fail to reload certificates when they are updated

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): tls certificate reload


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.1", GitCommit:"b0b7a323cc5a4a2019b2e9520c21c7830b7f708e", GitTreeState:"clean", BuildDate:"2017-04-25T14:48:12Z", GoVersion:"go1.8.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.1+coreos.0", GitCommit:"9212f77ed8c169a0afa02e58dce87913c6387b3e", GitTreeState:"clean", BuildDate:"2017-04-04T00:32:53Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: Digital Ocean / custom setup

  • OS (e.g. from /etc/os-release): coreos VERSION=1353.7.0

  • Kernel (e.g. uname -a): Linux coreos01.kub.do.modio.se 4.9.24-coreos #1 SMP Wed Apr 26 21:44:23 UTC 2017 x86_64 Intel® Xeon® CPU E5-2650L v3 @ 1.80GHz GenuineIntel GNU/Linux

  • Install tools: Ansible / CoreOS getting started guide

  • Others:

What happened: We came up to our scheduled update of TLS client certificate, TLS certs were updated properly, but kubelet and kube-proxy keep the old Certs in memory. This causes them to fail when communicating with APIserver.

What you expected to happen: kubelet & kube proxy should reload the certificates from disk.

How to reproduce it (as minimally and precisely as possible): Generate a cert with a short lifetime, set up your cluster, wait a while, and then replace the cert with a longer lived one.

Anything else we need to know: We’re attempting to run with short lived client certificates. This has shown some issues with how kubernetes handles it, and will likely cause others to have hard to debug problems in the future.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 11
  • Comments: 69 (40 by maintainers)

Most upvoted comments

/reopen

  1. Is tlsCertFile as part of KubeletConfiguration. We set this to 7d TTL and refresh daily. Kubelet needs to be restarted to use the new certificate.
  2. clientCAFile as part of:
authentication:
  x509:
    clientCAFile: "/etc/kubernetes/ssl/ca.pem"

config in the same KubeletConfiguration file. This has 1 - 2 yr validity for us, and again Kubelet (and kube-proxy) need a restart to use this.

Awesome. 😃

Does it do the CA’s too or just the client/server certs?

Not CA. Only certs.

From what I know for kubelet: Both the server tls config and client-go tls config doesn’t do CA File dynamic reload as of today

Gotcha! Well I don’t know of anyone right this moment that has the bandwidth/priority to take this one on (thus why it’s been continually going stale), but if you think you might have some time to spare I would encourage you to not worry about being a kubelet or kube-proxy expert. Reach out to the community (Slack, Zooms) and let them know you’re trying to learn how to get this one fixed: I expect you’ll find the community can provide some level of assistance (even if they themselves might not have the bandwidth/priority to take the whole thing on).

Maybe we can big-hammer this? If the file changes, os.Exit() - it’s clumsy but it should work?

Help Wanted

Experiencing the same issue.

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-12T00:44:36Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1+coreos.0", GitCommit:"59359d9fdce74738ac9a672d2f31e9a346c5cece", GitTreeState:"clean", BuildDate:"2017-10-12T21:53:13Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}