-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yaml
117 lines (115 loc) · 4.45 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# Configure
#
- hosts: localhost
become: yes
connection: local
tasks:
- name: Install Git
yum:
name: git
state: latest
- name: Run Install Helm
shell: curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
args:
executable: /bin/bash
- name: Add Bitnami's chart repository.
community.kubernetes.helm_repository:
name: bitnami
repo_url: "https://charts.bitnami.com/bitnami"
- name: Add Grafana repository..
community.kubernetes.helm_repository:
name: grafana
repo_url: "https://grafana.github.io/helm-charts"
- name: Create namespace kafka
shell: kubectl create namespace kafka
args:
executable: /bin/bash
- name: Create CustomResourceDefinition
shell: kubectl create -f https://strimzi.io/install/latest?namespace=kafka -n kafka
args:
executable: /bin/bash
- name: kafka-persistent-single.yaml
shell:
kubectl apply -f /vagrant/kafka/kafka-persistent-single.yaml -n kafka
args:
executable: /bin/bash
- name: Wait for Kafka Brokers
wait_for:
port: 30094
delay: 120
- name: Run install Kafkadrop
shell: |
set timeout 300
git clone https://github.com/obsidiandynamics/kafdrop
cd kafdrop/
helm upgrade -i kafdrop chart --set image.tag=3.27.0 \
--set kafka.brokerConnect=my-cluster-kafka-0.my-cluster-kafka-brokers.kafka.svc:9092 \
--set server.servlet.contextPath="/" \
--set jvm.opts="-Xms32M -Xmx64M"
exit 0
args:
executable: /bin/bash
- name: Wait for Kafkadrop
wait_for:
port: 30900
delay: 120
- name: Create namespace Monitoring
shell: kubectl create namespace monitoring
args:
executable: /bin/bash
- name: Create Prometheus
shell: helm install prometheus --set prometheus.service.type=NodePort,prometheus.service.nodePort=30090 bitnami/kube-prometheus -n monitoring
args:
executable: /bin/bash
- name: Configuring Prometheus 1 - 4 = create secret
shell: kubectl create secret generic additional-scrape-configs --from-file=/vagrant/prometheus/prometheus-additional.yaml -n monitoring
args:
executable: /bin/bash
- name: Configuring Prometheus 2 - 4 = pod-monitor
shell: kubectl apply -f /vagrant/prometheus/strimzi-pod-monitor.yaml -n monitoring
args:
executable: /bin/bash
- name: Configuring Prometheus 3 - 4 = prometheus-rules
shell: kubectl apply -f /vagrant/prometheus/prometheus-rules.yaml -n monitoring
args:
executable: /bin/bash
- name: Configuring Prometheus 4 - 4 = prometheus.yaml
shell: kubectl apply -f /vagrant/prometheus/prometheus.yaml -n monitoring
args:
executable: /bin/bash
- name: Wait for Prometheus
wait_for:
port: 30090
delay: 120
- name: Configuring Grafana
shell: helm install grafana -f /vagrant/grafana/grafana.yaml grafana/grafana -n monitoring
args:
executable: /bin/bash
- name: Wait for Grafana
wait_for:
port: 30300
delay: 120
- name: Configuring Producer Kafka
shell: kubectl apply -f /vagrant/kafka_python/producer.yaml
args:
executable: /bin/bash
- name: Wait for Producer Python
wait_for:
timeout: 120
delegate_to: localhost
- name: Configuring Consumer Kafka
shell: kubectl apply -f /vagrant/kafka_python/consumer.yaml
args:
executable: /bin/bash
- name: display post install message
debug:
msg:
- "Things left to do. In your host machine go:"
- "http://127.0.0.1:30900 - To open Kafkadrop and see topic and messages"
- "http://127.0.0.1:30090 - Prometheus"
- "http://127.0.0.1:30300 - Granafa Dashboards"
- "Brkoker Kafka: 127.0.0.1:30094"
- "https://github.com/mordp1/lab_kafka"
- "To see all pods : kubectl get pods --all-namespaces"
- "Best Regards"