plausible/kubernetes/plausible-events-db.yaml
2021-07-15 17:36:49 +08:00

104 lines
2.6 KiB
YAML

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: v1
kind: PersistentVolumeClaim
metadata:
name: plausible-events-db-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
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
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
volumes:
- name: clickhousedata
persistentVolumeClaim:
claimName: plausible-db-pvc
containers:
- name: plausible-events-db
image: yandex/clickhouse-server:latest
imagePullPolicy: Always
ports:
- containerPort: 8123
volumeMounts:
- name: clickhousedata
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:
memory: 200Mi
cpu: 250m
readinessProbe:
httpGet:
path: /ping
port: 8123
initialDelaySeconds: 20
failureThreshold: 6
periodSeconds: 10
livenessProbe:
httpGet:
path: /ping
port: 8123
initialDelaySeconds: 30
failureThreshold: 3
periodSeconds: 10