Rodney Osodo 2e767fc2f7 chore(release): Add release command
Relase creates a git tag and also docker tag and pushes the artefacts
2024-07-10 15:31:07 +03:00
2024-07-09 21:26:39 +03:00
2024-07-09 23:38:48 +03:00
2024-07-09 23:38:48 +03:00
2024-07-10 13:52:08 +03:00
2024-07-09 21:26:39 +03:00
2024-07-10 15:31:07 +03:00
2024-07-10 13:52:08 +03:00
2024-07-09 23:38:48 +03:00

nameko-prometheus

Testing nameko with Prometheus

Docker Compose

First step is to build the image:

make build-image

This step can be ignored if you want to use the image from Docker Registry.

Then, you can run the services:

docker compose -f docker-compose.yaml up

Simulate network traffic:

for i in {1..100}; do curl -X GET http://localhost:8000/goodbye && curl -X GET http://localhost:8000/hello; done

You can access the Prometheus dashboard at http://localhost:9090.

Kubernetes

You need to have a Kubernetes cluster running. You can use Minikube or Docker Desktop. Also, you need to have Helm installed.

Run

make install-prometheus-k8s

This command creates monitoring namespace, adds the Prometheus Helm repository, installs Prometheus, and exposes the Prometheus service.

You should see something like this:

Installing Prometheus on k8s
namespace/monitoring created
"prometheus-community" already exists with the same configuration, skipping
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "ory" chart repository
...Successfully got an update from the "bitnami" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
NAME: prometheus
LAST DEPLOYED: Wed Jul 10 13:41:15 2024
NAMESPACE: monitoring
STATUS: deployed
REVISION: 1
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
  kubectl --namespace monitoring get pods -l "release=prometheus"

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.
Prometheus installed on k8s
List of pods and services created by Prometheus on k8s
kubectl get pods -n monitoring
NAME                                                     READY   STATUS    RESTARTS   AGE
alertmanager-prometheus-kube-prometheus-alertmanager-0   1/2     Running   0          8s
prometheus-grafana-5c7b44cc98-ms982                      2/3     Running   0          11s
prometheus-kube-prometheus-operator-7dd887c879-8kzmr     1/1     Running   0          11s
prometheus-kube-state-metrics-84746dcf78-6dnm8           1/1     Running   0          11s
prometheus-prometheus-kube-prometheus-prometheus-0       1/2     Running   0          8s
prometheus-prometheus-node-exporter-gccqd                1/1     Running   0          11s
kubectl get svc -n monitoring
NAME                                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
alertmanager-operated                     ClusterIP   None            <none>        9093/TCP,9094/TCP,9094/UDP   8s
prometheus-grafana                        ClusterIP   10.43.105.240   <none>        80/TCP                       11s
prometheus-kube-prometheus-alertmanager   ClusterIP   10.43.97.21     <none>        9093/TCP,8080/TCP            11s
prometheus-kube-prometheus-operator       ClusterIP   10.43.224.94    <none>        443/TCP                      11s
prometheus-kube-prometheus-prometheus     ClusterIP   10.43.192.217   <none>        9090/TCP,8080/TCP            11s
prometheus-kube-state-metrics             ClusterIP   10.43.27.193    <none>        8080/TCP                     11s
prometheus-operated                       ClusterIP   None            <none>        9090/TCP                     8s
prometheus-prometheus-node-exporter       ClusterIP   10.43.206.103   <none>        9100/TCP                     11s
Expose Prometheus service on k8s
kubectl expose service prometheus-kube-prometheus-prometheus -n monitoring --type=NodePort --target-port=9090 --name=prometheus-kube-prometheus-prometheus-np
service/prometheus-kube-prometheus-prometheus-np exposed
Prometheus service exposed on k8s
kubectl get svc prometheus-kube-prometheus-prometheus-np -n monitoring
NAME                                       TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)                         AGE
prometheus-kube-prometheus-prometheus-np   NodePort   10.43.164.40   <none>        9090:32243/TCP,8080:32496/TCP   0s
Expose Grafana service on k8s
kubectl expose service prometheus-grafana -n monitoring --type=NodePort --target-port=3000 --name=prometheus-grafana-np
service/prometheus-grafana-np exposed
Grafana service exposed on k8s
kubectl get svc prometheus-grafana-np -n monitoring
NAME                    TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE
prometheus-grafana-np   NodePort   10.43.8.145   <none>        80:30461/TCP   1s

Prometheus and grafana services are exported as NodePort. You can access the Prometheus dashboard or Grafana dashboard.

From the above output, you can see that Prometheus is exposed on port 32243 and Grafana is exposed on port 30461.

Grafana login username is admin and password is prom-operator.

Deploy the services

Run the following command which deploys the services to Kubernetes:

make deploy-to-k8s

The services are exposed as NodePort.

Simulate network traffic:

for i in {1..1000}; do curl -X GET http://192.168.100.202:30081/goodbye &> /dev/null && curl -X GET http://192.168.100.202:30081/hello &> /dev/null; done

Example Dashboards

Cluster Information

Namespace Information

S
Description
No description provided
Readme MIT 2.3 MiB
Languages
Python 52.1%
Makefile 43%
Dockerfile 4.9%