Files
go-otel/k8s/clickhouse.yaml
T
mats 21f04d696b
Build and Publish / Metadata (push) Successful in 2s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 58s
more otel
2026-09-18 20:51:37 +00:00

135 lines
3.1 KiB
YAML

# Single-node ClickHouse for the otel-debug-receiver, applied as one file:
# kubectl apply -f k8s/clickhouse.yaml
#
# A single instance (per request): one StatefulSet replica with a PVC so
# telemetry survives pod restarts. Resources sized for a small cluster;
# adjust before production use.
apiVersion: v1
kind: Namespace
metadata:
name: otel-debug
---
apiVersion: v1
kind: Secret
metadata:
name: clickhouse-auth
namespace: monitoring
type: Opaque
stringData:
# Change these before applying. ClickHouse will honor the values from
# the users.d override mounted below, so no post-install SQL is needed.
username: otel
password: CHANGE_ME
---
apiVersion: v1
kind: ConfigMap
metadata:
name: clickhouse-config
namespace: monitoring
data:
users.d-otel.xml: |
<clickhouse>
<users>
<otel>
<password from_env="CLICKHOUSE_PASSWORD"/>
<networks><ip>::/0</ip></networks>
<grants>
<grant><query>GRANT ALL ON otel.*</query></grant>
</grants>
</otel>
</users>
</clickhouse>
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: clickhouse
namespace: monitoring
spec:
serviceName: clickhouse
replicas: 1
selector:
matchLabels:
app: clickhouse
template:
metadata:
labels:
app: clickhouse
spec:
securityContext:
fsGroup: 101
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:24.8
ports:
- containerPort: 9000
name: native
- containerPort: 8123
name: http
env:
- name: CLICKHOUSE_PASSWORD
valueFrom:
secretKeyRef:
name: clickhouse-auth
key: password
volumeMounts:
- name: data
mountPath: /var/lib/clickhouse
# Mount the user override as a single file: ConfigMap volumes are
# read-only, and the entrypoint needs to write its own
# default-user.xml into the users.d directory on first start.
- name: user-config
mountPath: /etc/clickhouse-server/users.d/otel.xml
subPath: users.d-otel.xml
readinessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
httpGet:
path: /ping
port: http
initialDelaySeconds: 30
periodSeconds: 30
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "2Gi"
cpu: "1"
volumes:
- name: user-config
configMap:
name: clickhouse-config
items:
- key: users.d-otel.xml
path: users.d-otel.xml
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: Service
metadata:
name: clickhouse
namespace: monitoring
spec:
selector:
app: clickhouse
ports:
- name: native
port: 9000
targetPort: 9000
- name: http
port: 8123
targetPort: 8123
type: ClusterIP