Prometheus Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 8: Line 8:


=Expose Prometheus Console in Kubernetes=
=Expose Prometheus Console in Kubernetes=
Prometheus comes with a built-in [[Prometheus_Concepts#Prometheus_Console|console]]. When Prometheus is deployed in Kubernetes and on some Kubernetes instances, such as Docker Desktop Kubernetes, access to console must be enabled explicitly by deploying a LoadBalancer service. Define prometheus-kube-prometheus-prometheus-lb.yaml:
Prometheus comes with a built-in [[Prometheus_Concepts#Prometheus_Console|console]]. When Prometheus is deployed in Kubernetes and on some Kubernetes instances, such as Docker Desktop Kubernetes, access to console must be enabled explicitly by deploying a LoadBalancer service. This works for [[Docker Desktop Kubernetes]], for another environment, expose the service accordingly.
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
namespace="prometheus"
namespace="prom"
cat <<EOF | kubectl -n ${namespace} -f -
cat <<EOF | kubectl -n ${namespace} apply -f -
apiVersion: v1
apiVersion: v1
kind: Service
kind: Service
metadata:
metadata:
  annotations:
    meta.helm.sh/release-name: prometheus
    meta.helm.sh/release-namespace: prometheus
  labels:
    app: kube-prometheus-stack-operator
    app.kubernetes.io/managed-by: Helm
    chart: kube-prometheus-stack-10.1.0
    heritage: Helm
    release: prometheus
   name: prometheus-kube-prometheus-prometheus-lb
   name: prometheus-kube-prometheus-prometheus-lb
   namespace: prometheus
   namespace: ${namespace}
spec:
spec:
   type: LoadBalancer
   type: LoadBalancer
Line 38: Line 29:
EOF
EOF
</syntaxhighlight>
</syntaxhighlight>
Test with: {{External|http://localhost:9090/}}


=Configuration Operations=
=Configuration Operations=
{{Internal|Prometheus_Configuration#Configuration_Operations|Prometheus Configuration Operations}}
{{Internal|Prometheus_Configuration#Configuration_Operations|Prometheus Configuration Operations}}

Latest revision as of 05:30, 16 October 2020

Internal

Installation

Installation with Helm

Installation with Helm

Installation with Prometheus Operator

Installation with Prometheus Operator

Expose Prometheus Console in Kubernetes

Prometheus comes with a built-in console. When Prometheus is deployed in Kubernetes and on some Kubernetes instances, such as Docker Desktop Kubernetes, access to console must be enabled explicitly by deploying a LoadBalancer service. This works for Docker Desktop Kubernetes, for another environment, expose the service accordingly.

namespace="prom"
cat <<EOF | kubectl -n ${namespace} apply -f -
apiVersion: v1
kind: Service
metadata:
  name: prometheus-kube-prometheus-prometheus-lb
  namespace: ${namespace}
spec:
  type: LoadBalancer
  ports:
  - name: http
    port: 9090
    protocol: TCP
    targetPort: 9090
  selector:
    app: prometheus
    prometheus: prometheus-kube-prometheus-prometheus
EOF

Test with:

http://localhost:9090/

Configuration Operations

Prometheus Configuration Operations