2021-07-15 04:36:49 -05:00
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: plausible-events-db
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
spec:
|
|
|
|
type: ClusterIP
|
|
|
|
ports:
|
|
|
|
- name: db
|
|
|
|
port: 8123
|
|
|
|
targetPort: 8123
|
|
|
|
protocol: TCP
|
|
|
|
selector:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
2021-07-19 00:54:58 -05:00
|
|
|
kind: StatefulSet
|
2021-07-15 04:36:49 -05:00
|
|
|
metadata:
|
|
|
|
name: plausible-events-db
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
2021-07-19 00:54:58 -05:00
|
|
|
serviceName: plausible-events-db
|
2021-07-15 04:36:49 -05:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
spec:
|
|
|
|
restartPolicy: Always
|
|
|
|
containers:
|
|
|
|
- name: plausible-events-db
|
|
|
|
image: yandex/clickhouse-server:latest
|
|
|
|
imagePullPolicy: Always
|
|
|
|
ports:
|
|
|
|
- containerPort: 8123
|
|
|
|
volumeMounts:
|
2021-07-19 00:54:58 -05:00
|
|
|
- name: data
|
2021-07-15 04:36:49 -05:00
|
|
|
mountPath: /var/lib/clickhouse
|
|
|
|
env:
|
|
|
|
- name: CLICKHOUSE_DB
|
|
|
|
value: plausible
|
|
|
|
- name: CLICKHOUSE_USER
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: plausible-events-db-user
|
|
|
|
key: username
|
|
|
|
- name: CLICKHOUSE_PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: plausible-events-db-user
|
|
|
|
key: password
|
|
|
|
securityContext:
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: 2Gi
|
|
|
|
cpu: 1500m
|
|
|
|
requests:
|
2021-07-19 01:05:07 -05:00
|
|
|
memory: 80Mi
|
|
|
|
cpu: 10m
|
2021-07-15 04:36:49 -05:00
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /ping
|
|
|
|
port: 8123
|
|
|
|
initialDelaySeconds: 20
|
|
|
|
failureThreshold: 6
|
|
|
|
periodSeconds: 10
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /ping
|
|
|
|
port: 8123
|
|
|
|
initialDelaySeconds: 30
|
|
|
|
failureThreshold: 3
|
|
|
|
periodSeconds: 10
|
2021-07-19 00:54:58 -05:00
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: data
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: clickhouse
|
|
|
|
app.kubernetes.io/component: database
|
|
|
|
app.kubernetes.io/part-of: plausible
|
|
|
|
spec:
|
|
|
|
accessModes: ["ReadWriteOnce"]
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 128Mi
|
|
|
|
limits:
|
|
|
|
storage: 20Gi
|