Deploy Production-ready Aidbox to Kubernetes
Production-ready infrastructure
Key infrastructure elements:
- Cluster configuration — Node pool and tooling
- Database — Cloud or self-managed database
- Aidbox — Aidbox installation
- Logging — Сollect application and cluster logs
- Monitoring — Сollect, alert, and visualize cluster and application metrics
- Security — Vulnerability scanning and policy management
Cluster configuration and tooling
Recommended Kubernetes cluster configuration:
- Small and medium workloads — 3 nodes X 4 VCPU 16 GB RAM
- Huge workloads — 3 nodes X 8 VCPU X 64 GB RAM
Toolkit required for development and deployment:
- AWS , GCP , AZURE - Cloud provider CLI and SDK. Depends on your cloud provider:
- Kubectl - connection and cluster management
- Helm - Kubernetes package manager
- Lens - Kubernetes IDE
Optional - Development and Delivery tooling:
- Terraform - Infrastructure automation tool
- Grafana tanka - configuration utility for your Kubernetes
- Argo CD - GitOps delivery and management
- Flux - set of continuous and progressive delivery solutions for Kubernetes
Database
Managed solution
Aidbox supports all popular managed Postgresql databases. Supported versions - 13 and higher. See more details in this article — Run Aidbox on managed PostgreSQL.
Self-managed solution
For a self-managed solution, we recommend using the AidboxDB image . This image contains all required extensions, backup tools, and pre-build replication support. Read more information in the documentation — AidboxDB.
To streamline the deployment process, our DevOps engineers have prepared Helm charts that you may find helpful.
First step — create volume
Next - create all required configs, like postgresql.conf
, required container parameters and credentials.
Now we can create a database StatefulSet
Create a master database service
Replica installation contains all the same steps but requires additional configuration
For backups and WAL archiving we recommend a cloud-native solution WAL-G . Full information about its configuration and usage is on this documentation page .
- Configure storage access — WAL-G can store backups in S3, Google Cloud Storage, Azure, or a local file system.
- Recommended backup policy — Full backup every week, incremental backup every day.
Alternative solutions
A set of tools to perform HA PostgreSQL with fail and switchover, automated backups.
- Patroni — A Template for PostgreSQL HA with ZooKeeper, ETCD or Consul.
- Postgres operator — The Postgres Operator delivers an easy-to-run HA PostgreSQL clusters on Kubernetes.
Aidbox
First, you must get an Aidbox license on the Aidbox user portal .
You might want to use the Helm charts prepared by our DevOps engineers to make the deployment experience smoother.
Create ConfigMap with all required config and database connection
This ConfigMap example uses our default Aidbox Configuration Project Template. It's recommended to clone this template and bind your Aidbox installation with it.
Aidbox Deployment
When Aidbox starts for the first time, resolving all the dependencies takes longer. If you encounter startupProbe failure, you might want to consider increasing the initialDelaySeconds and failureThreshold under the startupProbe spec in the config above.
All additional information about HA Aidbox configuration can be found in this article — HA Aidbox.
To verify that Aidbox started correctly you can check the logs:
kubectl logs -f <aidbox-pod-name>
Create the Aidbox k8s service
Ingress
A Cluster must have an ingress controller Installed.
Our recommendation is to use the Kubernetes Ingress NGINX Controller . As an alternative, you can use Traefic .
More additional information about Ingress in k8s can be found in this documentation — Kubernetes Service Networking
Ingress NGINX controller
Ingress-nginx — is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer.
CertManager
To provide a secure HTTPS connection you can use paid SSL certificates, issued for your domain, or use LetsEncrypt-issued certificates. In the case of using LetsEcrypt, we recommend installing and configuring Cert Manager Operator
Configure Cluster Issuer:
If you use Multibox image and want to use cert manger — you should configure DNS01 authorization to provide wildcard certificates
https://letsencrypt.org/docs/challenge-types/#dns-01-challenge
Ingress resource
Now you can create k8s Ingress
for Aidbox deployment
Now you can test ingress
curl https://my.box.url
Logging
General logging & audit information can be found in this article — Logging & Audit
Aidbox supports integration with the following systems:
- ElasticSearch — Elastic Logs and Monitoring Integration
- Loki — Grafana Loki Log management integration
- DataDog — Datadog Log management integration
ElasticSearch integration
You can install ECK using the official guide.
Configure Aidbox and ES integration
apiVersion: v1
kind: Secret
metadata:
name: aidbox
namespace: prod
data:
...
AIDBOX_ES_URL = http://es-service.es-ns.svc.cluster.local
AIDBOX_ES_AUTH = <user>:<password>
...
DataDog integration
apiVersion: v1
kind: Secret
metadata:
name: aidbox
namespace: prod
data:
...
AIDBOX_DD_API_KEY: <Datadog API Key>
...
Monitoring
For monitoring our recommendation is to use the Kube Prometheus stack
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack
Create Aidbox metrics service
Create ServiceMonitor config for scrapping metrics data
Or you can directly specify the Prometheus scrapers configuration
global:
external_labels:
monitor: 'aidbox'
scrape_configs:
- job_name: aidbox
scrape_interval: 5s
metrics_path: /metrics
static_configs:
- targets: [ 'aidbox-metrics.prod.svc.cluster.local:8765' ]
- job_name: aidbox-minutes
scrape_interval: 30s
metrics_path: /metrics/minutes
static_configs:
- targets: [ 'aidbox-metrics.prod.svc.cluster.local:8765' ]
- job_name: aidbox-hours
scrape_interval: 1m
scrape_timeout: 30s
metrics_path: /metrics/hours
static_configs:
- targets: [ 'aidbox-metrics.prod.svc.cluster.local:8765' ]
Alternative solutions
- VictoriaMetrics — High-Performance Open Source Time Series Database.
- Thanos — highly available Prometheus setup with long-term storage capabilities.
- Grafana Mimir — highly available, multi-tenant, long-term storage for Prometheus.
Export the Aidbox Grafana dashboard
Aidbox metrics has integration with Grafana, which can generate dashboards and upload them to Grafana — Grafana Integration
Additional monitoring
System monitoring:
- node exporter — Prometheus exporter for hardware and OS metrics exposed by *NIX kernels
- kube state metrics — is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects
- cadvisor — container usage metrics
PostgreSQL monitoring:
- pg_exporter — Prometheus exporter for PostgreSQL server metrics
Alerting
Alerting rules allow you to define alert conditions based on Prometheus expression language expressions and to send notifications about firing alerts to an external service.
Alert rules
Alert for long-running HTTP queries with P99 > 5s in 5m interval
Alert delivery
Alert manager template for Telegram
All other integrations you can find on the AlertManager documentation page.
Additional tools
- Embedded Grafana alerts
- Grafana OnCall
Security
Vulnerability and security scanners:
- Trivy operator — Kubernetes-native security toolkit.
- Trivy operator Lens extension — UI extension for Lens which provides visibility into Trivy reports
Kubernetes Policy Management:
- Kyverno OR Gatekeeper — Kubernetes policy management
Advanced:
- Datree — k8s resources linter
Last updated 2025-05-21T15:21:41Z