Skip to content

Commit a334a55

Browse files
authored
Merge pull request #133 from metacpan/ssoriche/metrics
Ingress NGINX metrics
2 parents 85900a6 + f9d097f commit a334a55

File tree

8 files changed

+4039
-32
lines changed

8 files changed

+4039
-32
lines changed

apps/grep/base/deployment.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,38 @@ spec:
1616
app: grep
1717
spec:
1818
initContainers:
19-
- name: repo-seed
20-
image: bitnami/git:latest
21-
imagePullPolicy: Always
22-
volumeMounts:
23-
- name: gitrepo
24-
mountPath: /shared/metacpan_git
25-
command:
26-
- sh
27-
- -c
28-
- |-
29-
[ -d /shared/metacpan_git/.git ] \
30-
|| git clone https://github.com/metacpan/metacpan-cpan-extracted.git /shared/metacpan_git \
31-
&& touch /shared/metacpan_git/.init_complete
19+
- name: repo-seed
20+
image: bitnami/git:latest
21+
imagePullPolicy: Always
22+
volumeMounts:
23+
- name: gitrepo
24+
mountPath: /shared/metacpan_git
25+
command:
26+
- sh
27+
- -c
28+
- |-
29+
[ -d /shared/metacpan_git/.git ] \
30+
|| git clone https://github.com/metacpan/metacpan-cpan-extracted.git /shared/metacpan_git \
31+
&& touch /shared/metacpan_git/.init_complete
3232
containers:
33-
- name: web
34-
image: metacpan/metacpan-grep-front-end:latest
35-
imagePullPolicy: Always
36-
ports:
37-
- containerPort: 3000
38-
envFrom:
39-
- configMapRef:
40-
name: grep
41-
resources:
42-
# Manage how much memory is allocated, could add cpu if we wanted
43-
requests:
44-
memory: "4072Mi"
45-
limits:
46-
memory: "4072Mi"
47-
volumeMounts:
48-
- name: gitrepo
49-
mountPath: /shared/metacpan_git
50-
readOnly: false
33+
- name: web
34+
image: metacpan/metacpan-grep-front-end:latest
35+
imagePullPolicy: Always
36+
ports:
37+
- containerPort: 3000
38+
envFrom:
39+
- configMapRef:
40+
name: grep
41+
resources:
42+
# Manage how much memory is allocated, could add cpu if we wanted
43+
requests:
44+
memory: "4072Mi"
45+
limits:
46+
memory: "4072Mi"
47+
volumeMounts:
48+
- name: gitrepo
49+
mountPath: /shared/metacpan_git
50+
readOnly: false
5151
volumes:
5252
- name: gitrepo
5353
persistentVolumeClaim:

platform/ingress-nginx/kustomization.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44
resources:
55
- https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.1/deploy/static/provider/do/deploy.yaml
6+
- service.yaml
7+
- servicemonitor.yaml
68
patchesStrategicMerge:
79
- |-
810
apiVersion: v1
@@ -26,6 +28,23 @@ patchesStrategicMerge:
2628
replicas: 3
2729
template:
2830
spec:
31+
containers:
32+
- name: controller
33+
args:
34+
- /nginx-ingress-controller
35+
- --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller
36+
- --election-id=ingress-nginx-leader
37+
- --controller-class=k8s.io/ingress-nginx
38+
- --ingress-class=nginx
39+
- --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
40+
- --validating-webhook=:8443
41+
- --validating-webhook-certificate=/usr/local/certificates/cert
42+
- --validating-webhook-key=/usr/local/certificates/key
43+
- --enable-metrics=true
44+
ports:
45+
- name: metrics
46+
containerPort: 10254
47+
protocol: TCP
2948
affinity:
3049
podAntiAffinity:
3150
requiredDuringSchedulingIgnoredDuringExecution:
@@ -35,4 +54,4 @@ patchesStrategicMerge:
3554
operator: In
3655
values:
3756
- ingress-nginx
38-
topologyKey: "kubernetes.io/hostname"
57+
topologyKey: "kubernetes.io/hostname"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: ingress-nginx-controller-metrics
5+
namespace: ingress-nginx
6+
labels:
7+
app.kubernetes.io/name: ingress-nginx
8+
app.kubernetes.io/instance: ingress-nginx
9+
app.kubernetes.io/component: controller
10+
spec:
11+
type: ClusterIP
12+
ports:
13+
- name: metrics
14+
port: 10254
15+
targetPort: 10254
16+
protocol: TCP
17+
selector:
18+
app.kubernetes.io/name: ingress-nginx
19+
app.kubernetes.io/instance: ingress-nginx
20+
app.kubernetes.io/component: controller
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: ServiceMonitor
3+
metadata:
4+
name: ingress-nginx-controller
5+
namespace: ingress-nginx
6+
labels:
7+
app.kubernetes.io/name: ingress-nginx
8+
app.kubernetes.io/part-of: ingress-nginx
9+
release: prometheus
10+
spec:
11+
endpoints:
12+
- port: metrics
13+
interval: 30s
14+
path: /metrics
15+
selector:
16+
matchLabels:
17+
app.kubernetes.io/name: ingress-nginx
18+
app.kubernetes.io/instance: ingress-nginx
19+
app.kubernetes.io/component: controller
20+
namespaceSelector:
21+
matchNames:
22+
- ingress-nginx

0 commit comments

Comments
 (0)