Skip to content

e345ee/K8s-ClickHouse-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClickHouse Kubernetes Deployment

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.

Features

  • 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

Project Structure

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

Parameterization

Default values are defined in the Makefile:

CLICKHOUSE_VERSION ?= 24.8
ADMIN_USER        ?= admin
ADMIN_PASSWORD    ?= admin_password
READONLY_USER     ?= readonly
READONLY_PASSWORD ?= readonly_password

They 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.

Local Run

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

CI/CD

GitHub Actions runs the full validation cycle:

  1. Creates a kind cluster.
  2. Generates manifests through make generate.
  3. Deploys ClickHouse (make apply).
  4. Waits for the StatefulSet to become ready.
  5. Runs a SELECT 1 query through clickhouse-client (make test).
  6. Deletes the resources (make delete).

The workflow is located at .github/workflows/clickhouse-ci.yml.

Project Purpose

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.

About

Kubernetes deployment for ClickHouse with parameterized manifests, Makefile automation, persistent storage, health checks, and GitHub Actions CI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors