-
Notifications
You must be signed in to change notification settings - Fork 9
/
continuous-k6k8s.yaml
148 lines (146 loc) · 3.06 KB
/
continuous-k6k8s.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
apiVersion: v1
kind: Service
metadata:
name: influxdb-service
spec:
type: ClusterIP
ports:
- port: 8086
protocol: TCP
selector:
app: influxdb
---
apiVersion: v1
kind: Pod
metadata:
name: influxdb
labels:
app: influxdb
spec:
containers:
- name: influxdb
image: influxdb:1.8-alpine
env:
- name: INFLUXDB_DB
value: k6
ports:
- name: web
containerPort: 8086
---
apiVersion: v1
kind: Service
metadata:
name: grafana-service
spec:
type: LoadBalancer
ports:
- port: 3000
protocol: TCP
selector:
app: grafana
---
apiVersion: v1
kind: ConfigMap
metadata:
name: datasource-config
data:
grafana-datasource.yaml: |
apiVersion: 1
datasources:
- name: k6influxdb
type: influxdb
access: proxy
database: k6
url: http://influxdb-service:8086
isDefault: true
---
apiVersion: v1
kind: Pod
metadata:
name: grafana
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:7.4.0
env:
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: Admin
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_BASIC_ENABLED
value: "false"
ports:
- name: web
containerPort: 3000
volumeMounts:
- name: datasource-vol
mountPath: /etc/grafana/provisioning/datasources/
readOnly: true
volumes:
- name: datasource-vol
configMap:
name: datasource-config
items:
- key: "grafana-datasource.yaml"
path: "datasource.yaml"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: k6-scripts
data:
nginx-test.js: |
import {check, sleep, group} from "k6";
import http from "k6/http";
export let options = {
vus: 10,
duration: '30s',
batchPerHost: 4,
insecureSkipTLSVerify: true,
thresholds: {
'http_req_duration{kind:html}': ['avg<=250', 'p(95)<500'],
}
};
export default function () {
group("static", function () {
check(http.get(`http://${__ENV.TARGET_HOSTNAME}:80`, {
tags: {'kind': 'html'},
}), {
"status is 200": (res) => res.status === 200,
});
});
sleep(1);
}
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: k6-nginx-test
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: k6
image: loadimpact/k6:0.30.0
env:
- name: K6_OUT
value: influxdb=http://influxdb-service:8086/k6
- name: TARGET_HOSTNAME
value: nginx-service.default.svc.cluster.local
args:
- run
- /scripts/nginx-test.js
volumeMounts:
- name: scripts-vol
mountPath: /scripts
restartPolicy: Never
volumes:
- name: scripts-vol
configMap:
name: k6-scripts