Skip to content

Commit

Permalink
fix(inputs/kube_inventory): set TLS server name config properly (#9975)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2fdf223)
  • Loading branch information
slai authored and MyaLongmire committed Dec 8, 2021
1 parent e174106 commit ec5068b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/inputs/kube_inventory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ avoid cardinality issues:
# tls_cert = "/path/to/certfile"
## Used for TLS client certificate authentication
# tls_key = "/path/to/keyfile"
## Send the specified TLS server name via SNI
# tls_server_name = "kubernetes.example.com"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false

Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/kube_inventory/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type client struct {
func newClient(baseURL, namespace, bearerToken string, timeout time.Duration, tlsConfig tls.ClientConfig) (*client, error) {
c, err := kubernetes.NewForConfig(&rest.Config{
TLSClientConfig: rest.TLSClientConfig{
ServerName: baseURL,
ServerName: tlsConfig.ServerName,
Insecure: tlsConfig.InsecureSkipVerify,
CAFile: tlsConfig.TLSCA,
CertFile: tlsConfig.TLSCert,
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/kube_inventory/kube_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ var sampleConfig = `
# tls_ca = "/path/to/cafile"
# tls_cert = "/path/to/certfile"
# tls_key = "/path/to/keyfile"
# tls_server_name = "kubernetes.example.com"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
`
Expand Down

0 comments on commit ec5068b

Please sign in to comment.