Skip to content

Commit b6ca8b5

Browse files
committed
Configure local k8s deploy
1 parent df387f2 commit b6ca8b5

24 files changed

Lines changed: 104 additions & 248 deletions

File tree

gateway/src/main/resources/application-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
management:
1616
otlp:
1717
tracing:
18-
endpoint: http://jaeger:4318/v1/traces
18+
endpoint: ${COLLECTOR_ENDPOINT:http://jaeger:4318/v1/traces}
1919

2020
logging:
2121
pattern:

gateway/src/main/resources/application-k8s.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
management:
1616
otlp:
1717
tracing:
18-
endpoint: http://jaeger:4318/v1/traces
18+
endpoint: ${COLLECTOR_ENDPOINT:http://jaeger:4318/v1/traces}
1919

2020
logging:
2121
pattern:

gateway/src/test/kotlin/ru/romanow/services/gateway/filters/test.java

Lines changed: 0 additions & 145 deletions
This file was deleted.

k8s/README.md

Lines changed: 30 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -16,97 +16,70 @@ $ helm repo update
1616

1717
# set local address
1818
$ sudo tee -a /etc/hosts >/dev/null <<EOT
19-
127.0.0.1 store.local
20-
127.0.0.1 orders.local
21-
127.0.0.1 warehouse.local
22-
127.0.0.1 warranty.local
19+
127.0.0.1 gateway.local
2320
127.0.0.1 grafana.local
2421
127.0.0.1 jaeger.local
2522
127.0.0.1 kibana.local
26-
127.0.0.1 keycloak
2723
EOT
2824

2925
# install postgres
3026
$ helm install postgres romanow/postgres --values postgres/values.yaml
3127

32-
# install postgres exporter
33-
$ helm install postgres-exporter prometheus-community/prometheus-postgres-exporter \
34-
--values=postgres-exporter/values.yaml
35-
36-
# install monitoring (Prometheus Stack)
37-
$ kubectl create secret generic grafana-credentials \
38-
--from-literal=admin-user=admin \
39-
--from-literal=admin-password=admin
40-
41-
$ helm install prometheus-stack prometheus-community/kube-prometheus-stack \
42-
--values monitoring/deploy-values.yaml
43-
4428
# install services
29+
$ helm install gateway romanow/java-service --values=services/common-values.yaml --values=services/gateway-values.yaml
4530
$ helm install store romanow/java-service --values=services/common-values.yaml --values=services/store-values.yaml
46-
$ helm install orders romanow/java-service --values=services/common-values.yaml --values=services/gateway-values.yaml
4731
$ helm install warehouse romanow/java-service --values=services/common-values.yaml --values=services/warehouse-values.yaml
4832
$ helm install warranty romanow/java-service --values=services/common-values.yaml --values=services/warranty-values.yaml
4933

5034
$ cd ../tests/postman
51-
$ newman run -e kind-environment.json --folder=store collection.json
35+
$ newman run -e k8s-auth0.json collection.json
5236

5337
```
5438

39+
## Postgres Exporter
40+
41+
```shell
42+
$ helm install postgres-exporter prometheus-community/prometheus-postgres-exporter --values=postgres-exporter/values.yaml
43+
```
44+
5545
#### Grafana + Prometheus
5646

5747
```shell
58-
$ helm upgrade monitoring monitoring-chart --set grafana.domain=local
48+
49+
$ helm install node-exporter romanow/node-exporter
50+
$ helm install kube-state-metrics romanow/kube-state-metrics
51+
$ helm install prometheus romanow/prometheus
52+
$ helm install grafana romanow/grafana --set ingress.domain=local
5953
```
6054

61-
Открыть в браузере [http://grafana.local](http://grafana.local).
55+
Install Prometheus Operator:
56+
57+
```shell
58+
$ kubectl create secret generic grafana-credentials \
59+
--from-literal=admin-user=admin \
60+
--from-literal=admin-password=admin
6261

63-
##### Dashboard
64-
65-
Импортировать Grafana dashboards: `Create` -> `Import` -> `Import via grafana.com`.
66-
67-
* Node Exporter – [12486](https://grafana.com/grafana/dashboards/12486-node-exporter-full/)
68-
* Spring Boot – [10280](https://grafana.com/grafana/dashboards/10280-microservices-spring-boot-2-1/)
69-
* Kubernetes Global – [15757](https://grafana.com/grafana/dashboards/15757-kubernetes-views-global/)
70-
* Kubernetes Nodes – [15759](https://grafana.com/grafana/dashboards/15759-kubernetes-views-nodes/)
71-
* Kubernetes Namespaces – [15758](https://grafana.com/grafana/dashboards/15758-kubernetes-views-namespaces/)
72-
* Kubernetes Pods – [15760](https://grafana.com/grafana/dashboards/15760-kubernetes-views-pods/)
73-
74-
Другие доски доступны на [Grafana Labs](https://grafana.com/grafana/dashboards/).
75-
76-
## Alerting
77-
78-
* Создать бота: в telegram находим `@BotFather`, вызываем `/newbot`:
79-
* name: _k8s_monitoring_
80-
* id: _k8s_monitoring_bot_
81-
* Создать канал _K8S Monitoring_, добавить `@k8s_monitoring_bot` как администратора. Отправить хотя бы одно сообщение в
82-
группу.
83-
* После этого через Telegram API получить chart ID:
84-
```http request
85-
GET https://api.telegram.org/bot<token>/getUpdates
86-
```
87-
* Создать Notification Channel: `Grafana` -> `Alerting` -> `Notification Channels` -> `Telegram Bot`.
88-
* Создать новый dashboard:
89-
* Title: Request Count
90-
* Panel: `Query: sum(irate(http_server_requests_seconds_count{application="store"}[5m]))`
91-
* Alerting:
92-
* Condition: `Evaluate every: 10s for 0, when avg() of query(A, 10s, now) is above 10`
93-
* Send to: `Telegram bot`, message: `Too many requests`
62+
$ helm install prometheus-stack prometheus-community/kube-prometheus-stack --values monitoring/deploy-values.yaml
63+
```
64+
65+
Открыть в браузере [http://grafana.local](http://grafana.local).
9466

9567
#### ELK Stack
9668

9769
```shell
98-
$ helm upgrade elasticsearch elasticsearch-chart
99-
100-
$ helm upgrade logging logging-chart --set kibana.domain=local
70+
$ helm install fluent-bit romanow/fluent-bit
71+
$ helm install elasticsearch romanow/elastic --values=elastic/values.yaml
72+
$ helm install kibana romanow/kibana --set ingress.domain=local
10173
```
10274

10375
Открыть в браузере [http://kibana.local](http://kibana.local).
10476

10577
#### Jaeger
10678

10779
```shell
108-
# для работы требуется ElasticSearch
109-
$ helm upgrade jaeger jaeger-chart --set domain=local
80+
$ helm install elasticsearch romanow/elastic --values=elastic/values.yaml
81+
$ helm install prometheus romanow/prometheus
82+
$ helm install jaeger romanow/jaeger --set ingress.domain=local
11083
```
11184

11285
Открыть в браузере [http://jaeger.local](http://jaeger.local).

k8s/fluent-bit/values.yaml

Whitespace-only changes.

k8s/kind.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ nodes:
1515
- containerPort: 443
1616
hostPort: 443
1717
protocol: TCP
18-
- containerPort: 32432
19-
hostPort: 32432
20-
protocol: TCP

k8s/logging/values.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
global:
2-
namespace: logging
File renamed without changes.

0 commit comments

Comments
 (0)