<p>Running kubernetes 1.15 in azure.</p>
<p>I need a basic alert (e-mail/slack notification) when one or more of my applications/pods are down in kubernetes.</p>
<p>As an example I have <a href="https://cert-manager.io/docs/" rel="nofollow noreferrer">https://cert-manager.io/docs/</a> running in multiple clusters (hosted in azure) and I would like to get an alert (e-mail/slack notification) if it stops running.</p>
<p>Based on this post:</p>
<p><a href="https://stackoverflow.com/questions/55691394/how-do-i-set-up-a-hook-to-send-an-email-on-kubernetes-pod-restart">How do I set up a hook to send an email on Kubernetes pod restart?</a></p>
<p>it seems to get an e-mail alert I need to install Prometheus + Grafana access the web-ui and configure alerts so based on:</p>
<p><a href="https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack" rel="nofollow noreferrer">https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack</a></p>
<p><a href="https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack" rel="nofollow noreferrer">https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack</a></p>
<p>I have tried:</p>
<pre><code>helm version
version.BuildInfo{Version:&quot;v3.1.2&quot;, GitCommit:&quot;d878d4d45863e42fd5cff6743294a11d28a9abce&quot;, GitTreeState:&quot;clean&quot;, GoVersion:&quot;go1.13.8&quot;}


helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo update

helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --namespace monitoring
</code></pre>
<p>But that gives:</p>
<pre><code>Error: failed to install CRD crds/crd-alertmanager.yaml: unable to recognize &quot;&quot;: no matches for kind &quot;CustomResourceDefinition&quot; in version &quot;apiextensions.k8s.io/v1&quot;
</code></pre>
<p>Here there is some guide on how to create the crds manually:</p>
<p><a href="https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#helm-fails-to-create-crds" rel="nofollow noreferrer">https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#helm-fails-to-create-crds</a></p>
<p>but that should only be necessary if running helm 2.x which I am not I am running 3.1.2.</p>
<p>Also if I try to install them manually I get:</p>
<pre><code>$ kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml
error: unable to recognize &quot;https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml&quot;: no matches for kind &quot;CustomResourceDefinition&quot; in version &quot;apiextensions.k8s.io/v1&quot;
$ kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml
error: unable to recognize &quot;https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml&quot;: no matches for kind &quot;CustomResourceDefinition&quot; in version &quot;apiextensions.k8s.io/v1&quot;
$ kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
error: unable to recognize &quot;https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/release-0.42/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml&quot;: no matches for kind &quot;CustomResourceDefinition&quot; in version &quot;apiextensions.k8s.io/v1&quot;
...
</code></pre>
<p>Also I found this <strong>kube-prometheus stack</strong> compatibility matrix:</p>
<p><a href="https://github.com/prometheus-operator/kube-prometheus#compatibility" rel="nofollow noreferrer">https://github.com/prometheus-operator/kube-prometheus#compatibility</a></p>
<p>but versions in that matris does not match the ones I get:</p>
<pre><code>$ helm search repo prometheus-community/kube-prometheus-stack --versions
NAME                                        CHART VERSION   APP VERSION DESCRIPTION                                       
prometheus-community/kube-prometheus-stack  10.1.2          0.42.1      kube-prometheus-stack collects Kubernetes manif...
prometheus-community/kube-prometheus-stack  10.1.1          0.42.1      kube-prometheus-stack collects Kubernetes manif...
prometheus-community/kube-prometheus-stack  10.1.0          0.42.1      kube-prometheus-stack collects Kubernetes manif...
prometheus-community/kube-prometheus-stack  10.0.2          0.42.1      kube-prometheus-stack collects Kubernetes manif...
prometheus-community/kube-prometheus-stack  10.0.1          0.42.1      kube-prometheus-stack collects Kubernetes manif...
</code></pre>
<p>So seems that might be a 3rd way to install Prometheus</p>
<p>Any input appreciated.</p>
<p><strong>UPDATE:</strong></p>
<p>Randomly selecting the previous major version (9.4.10) seems to work:</p>
<pre><code>$ helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack --namespace monitoring --version 9.4.10
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
manifest_sorter.go:192: info: skipping unknown hook: &quot;crd-install&quot;
NAME: kube-prometheus-stack
LAST DEPLOYED: Fri Oct 23 15:15:03 2020
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
  kubectl --namespace monitoring get pods -l &quot;release=kube-prometheus-stack&quot;

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create &amp; configure Alertmanager and Prometheus instances using the Operator.
</code></pre>
<p>Guess trial and error is the way to go when installing stuff on older k8s version, could be great with compatibility matrices though.</p>

<p>Based on the kube-prometheus-stack repo, this helm chart is restricted for K8s versions 1.16.0 or above;</p>
<blockquote>
<p>kubeVersion: &quot;&gt;=1.16.0-0&quot;</p>
</blockquote>
<p>Even though the github README says the prerequisites as <code>Kubernetes 1.10+ with Beta APIs</code>, internally the helm chart checks for the kube version to be 1.16.0 or above.</p>
<p>So I believe, you will need to try this on an upgrade K8s cluster.</p>
<p>If upgrading the cluster is not an option, maybe you could try the deprecated old version of this.</p>
<p><a href="https://github.com/helm/charts/tree/master/stable/prometheus" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/prometheus</a></p>
