Skip to content

Commit

Permalink
fix: use both self-signed and Kubernetes CA to verify Kubelet cert
Browse files Browse the repository at this point in the history
Kubelet might be running either self-signed cert (by default) or API
server issued cert (signed by the CA). User might switch between the two
methods, so instead of guessing based on filesystem contents, accept
both Kubernetes CA and self-signed cert (if available).

Spotted by @aceat64

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Apr 26, 2021
1 parent a3537a6 commit 2261d7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kubernetes/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewClient(clientCert, clientKey, caPEM []byte) (*Client, error) {

kubeletCert, err := ioutil.ReadFile(filepath.Join(constants.KubeletPKIDir, "kubelet.crt"))
if err == nil {
config.CAData = kubeletCert
config.CAData = append(config.CAData, kubeletCert...)
} else if err != nil {
// ignore if file doesn't exist, assume cert isn't self-signed
if !os.IsNotExist(err) {
Expand Down

0 comments on commit 2261d7e

Please sign in to comment.