<p>I have an nginx-pod which redirects traffic into Kubernetes services and stores related certificates insides its volume. I want to monitor these certificates - mainly their expiration.</p>
<p>I found out that there is a TLS integration in Datadog (we use Datadog in our cluster): <a href="https://docs.datadoghq.com/integrations/tls/?tab=host" rel="nofollow noreferrer">https://docs.datadoghq.com/integrations/tls/?tab=host</a>.</p>
<p>They provide sample file, which can be found here: <a href="https://github.com/DataDog/integrations-core/blob/master/tls/datadog_checks/tls/data/conf.yaml.example" rel="nofollow noreferrer">https://github.com/DataDog/integrations-core/blob/master/tls/datadog_checks/tls/data/conf.yaml.example</a></p>
<p>To be honest, I am completely lost and do not understand comments of the sample file - such as:</p>
<pre><code>## @param server - string - required
## The hostname or IP address with which to connect.
</code></pre>
<p>I want to monitor certificates that are stored in the pod, does it mean this value should be localhost or do I need to somehow iterate over all the certificates that are stored using this value (such as server_names in nginx.conf)?
If anyone could help me with setting sample configuration, I would be really grateful - if there are any more details I should provide, that is not a problem at all.</p>

<h3>TLS Setup on Host</h3>
<p>You can use a host type of instance to track all your certificate expiration dates</p>
<p>1- Install TLS Integration from datadog UI</p>
<p>2- Create instance and install datadog agent in there.</p>
<p>3- Create a /etc/datadog/conf.d/tls.d/conf.yaml</p>
<p>4- Edit following template for your need</p>
<pre><code>init_config:
instances:

    ## @param server - string - required
    ## The hostname or IP address with which to connect.
    #
  - server: https://yourDNS1.com/
    tags:
      - dns:yourDNS.com
  - server: https://yourDNS2.com/
    tags:
      - dns:yourDNS2
  - server: yourDNS3.com
    tags:
      - dns:yourDNS3
  - server: https://yourDNS4.com/
    tags:
      - dns:yourDNS4.com
  - server: https://yourDNS5.com/
    tags:
      - dns:yourDNS5.com
  - server: https://yourDNS6.com/
    tags:
      - dns:yourDNS6.com
</code></pre>
<p>5- Restart datadog-agent</p>
<pre><code>systemctl restart datadog-agent
</code></pre>
<p>6- Check status if you see the tls is running successfully</p>
<pre><code>watch systemctl status datadog-agent
</code></pre>
<p>8- Create a TLS Overview Dashboard</p>
<p>9- Create a Monitor for getting alert on expiration dates</p>
<hr />
<h3>TLS Setup on Kubernetes</h3>
<p>1- Create a ConfigMap and attach that as a Volume
<a href="https://docs.datadoghq.com/agent/kubernetes/integrations/?tab=configmap" rel="nofollow noreferrer">https://docs.datadoghq.com/agent/kubernetes/integrations/?tab=configmap</a></p>
