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.
@@ -73,7 +73,9 @@ func (c *KubeletClientConfig) transportConfig() *transport.Config {
KeyFile: c.KeyFile,
KeyData: c.KeyData,
},
- BearerToken: c.BearerToken,
+ }
+ if c.EnableHttps {
+ cfg.BearerToken = c.BearerToken
}
if c.EnableHttps && !cfg.HasCA() {
cfg.TLS.Insecure = true
