# Kube-state-metrics over SSL

**URL:** https://discuss.elastic.co/t/kube-state-metrics-over-ssl/208537
**Category:** Beats
**Tags:** metricbeat
**Created:** [November 19, 2019, 3:25pm UTC](https://discuss.elastic.co/t/kube-state-metrics-over-ssl/208537 "2019-11-19T15:25:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![trumbaut](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@trumbaut](https://discuss.elastic.co/u/trumbaut)
#### Post date: [November 19, 2019, 3:25pm UTC](https://discuss.elastic.co/t/kube-state-metrics-over-ssl/208537/1 "2019-11-19T15:25:02Z")

</div>

We try to get data from the kube-state-metrics pod in OpenShift. This works fine if we start a standalone kube-state-metrics pod and expose it over an HTTP route:

```
- module: kubernetes
  enabled: true
  metricsets:
    - state_node
    - state_deployment
    - state_replicaset
    - state_pod
    - state_container
  period: 10s
  in_cluster: false
  add_metadata: true
  labels.dedot: true
  annotations.dedot: true
  kube_config: /home/user/.kube/config
  host: "master01.example.com"
  hosts: ["kube-state-metrics.monitoring.svc:8080"]

```

However, if we try to use the kube-state-metrics pod which is part of the default OpenShift Container Platform since version 3.11 (located in the openshift-monitoring project), we need HTTPS for this:

```
- module: kubernetes
  enabled: true
  metricsets:
    - state_node
    - state_deployment
    - state_replicaset
    - state_pod
    - state_container
  period: 10s
  in_cluster: false
  add_metadata: true
  labels.dedot: true
  annotations.dedot: true
  kube_config: /home/user/.kube/config
  host: "master01.example.com"
  hosts: ["https://prometheus-k8s-openshift-monitoring.example.com"]
  ssl.certificate_authorities: ["/etc/pki/ca-trust/source/anchors/openshift-ca.crt"]
  ssl.certificate: "/etc/origin/master/master.kubelet-client.crt"
  ssl.key: "/etc/origin/master/master.kubelet-client.key"

```

We do not get any relevant information in the Metricbeat debug logs, but no metricset data is sent to Elasticsearch anymore.

How can we use kube-state-metrics over SSL?

---

<div class="post-metadata">

### Author: ![trumbaut](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@trumbaut](https://discuss.elastic.co/u/trumbaut)
#### Post date: [November 22, 2019, 1:12pm UTC](https://discuss.elastic.co/t/kube-state-metrics-over-ssl/208537/2 "2019-11-22T13:12:46Z")

</div>

It turned out that the metrics provided by the kube-state-metrics pod in the openshift-monitoring project were very limited: +/- 650 entries versus \>13.000 entries provided by a standalone kube-state-metrics pod (version 1.8.0). So we left the track to reuse the kube-state-metrics pod in the openshift-monitoring project.

For your reference, the simplified config looks like this:

```
- module: kubernetes
  enabled: true
  metricsets:
    - state_node
    - state_deployment
    - state_replicaset
    - state_statefulset
    - state_pod
    - state_container
  period: 10s
  hosts: ["kube-state-metrics.monitoring.svc:8080"]
```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 20, 2019, 1:12pm UTC](https://discuss.elastic.co/t/kube-state-metrics-over-ssl/208537/3 "2019-12-20T13:12:52Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
