Skip to content
This repository was archived by the owner on Dec 1, 2018. It is now read-only.

Commit 6376e0a

Browse files
committed
Avoid passing token when using http
Bearer token is required on kubelet secure port that uses HTTPS. Sending token to insecure port can pose security risk.
1 parent 6d6f584 commit 6376e0a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

metrics/sources/kubelet/util/kubelet_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ func (c *KubeletClientConfig) transportConfig() *transport.Config {
7373
KeyFile: c.KeyFile,
7474
KeyData: c.KeyData,
7575
},
76-
BearerToken: c.BearerToken,
76+
}
77+
if c.EnableHttps {
78+
cfg.BearerToken = c.BearerToken
7779
}
7880
if c.EnableHttps && !cfg.HasCA() {
7981
cfg.TLS.Insecure = true

0 commit comments

Comments
 (0)