This project deploys a single ClickHouse instance to Kubernetes with a parameterized configuration.
YAML manifest templates are generated through envsubst, resources are managed with a Makefile, and deployment validation is implemented in GitHub Actions.
- StatefulSet with a single ClickHouse instance
- Parameterized image version and user credentials
- ConfigMap with custom ClickHouse user configuration (
users.xml) - Secret for storing user passwords
- Liveness and readiness probes
- Resource requests and limits
- PersistentVolumeClaim for data storage
- Makefile for generating, applying, and deleting manifests
- Automated deployment validation through GitHub Actions
clickhouse-k8s/
├── k8s/
│ ├── namespace.yaml
│ ├── service.yaml
│ ├── statefulset.yaml.tpl
│ ├── configmap-users.yaml.tpl
│ ├── secret-users.yaml.tpl
│ └── generated/ # generated manifests are created automatically
├── values.yaml # documented parameter description
├── Makefile # generation and deployment automation
└── .github/workflows/
└── clickhouse-ci.yml
Default values are defined in the Makefile:
CLICKHOUSE_VERSION ?= 24.8
ADMIN_USER ?= admin
ADMIN_PASSWORD ?= admin_password
READONLY_USER ?= readonly
READONLY_PASSWORD ?= readonly_passwordThey can be overridden at runtime:
CLICKHOUSE_VERSION=25.1 ADMIN_PASSWORD=secret make apply
The values.yaml file provides a documented set of the same parameters.
Required tools:
- a Kubernetes cluster (kind, minikube, or another cluster)
- kubectl
- make
- envsubst (part of gettext-base)
Deployment:
make apply
Status check:
make status
Connection test:
make test
Delete resources:
make delete
GitHub Actions runs the full validation cycle:
- Creates a kind cluster.
- Generates manifests through
make generate. - Deploys ClickHouse (
make apply). - Waits for the StatefulSet to become ready.
- Runs a
SELECT 1query through clickhouse-client (make test). - Deletes the resources (
make delete).
The workflow is located at .github/workflows/clickhouse-ci.yml.
The solution demonstrates basic DevOps skills:
- using Kubernetes as a deployment environment,
- parameterizing configuration,
- automating manifest workflows,
- working with Secret and ConfigMap resources,
- configuring probes and resources,
- using CI to validate operability.