Kubernetes
Kubernetes is an open-source platform designed to automate deploying, scaling, and operating containerized applications. It provides a robust framework for running distributed systems resiliently, handling scaling and failover, and managing application updates seamlessly. Kubernetes has gained popularity because it enables organizations to efficiently manage complex applications at scale. It improves resource utilization, and supports cloud-native development practices.
The Kubernetes Service
Smarter manages the resources of its Kubernetes cluster, for example the Ingress of each
LLMClient, and the StatefulSet of each self-hosted vectorstore, with the Kubernetes service of
the infrastructure services. It uses
kubectl, the command-line tool for
Kubernetes, with the kubeconfig that the cloud provider writes, for example with
aws eks update-kubeconfig for AWS EKS. kubectl works the same with any cluster, so the
service does not depend on the cloud.
from string import Template
from smarter.apps.infrastructure.services import infrastructure
with open("k8s/ingress.yaml.tpl", encoding="utf-8") as ingress_template:
template = Template(ingress_template.read())
manifest = template.substitute(ingress_values)
infrastructure.kubernetes.apply_manifest(manifest)
Applying a manifest that provisions billable cloud resources, for example a PersistentVolumeClaim, which provisions a block storage volume, or a Service of type LoadBalancer, sends the infrastructure’s billable resource signals, and records the resources in the infrastructure resource ledger.
Kubernetes Service Technical Reference
Helm Chart
The Smarter Framework includes a Helm chart for deploying Smarter on Kubernetes. The chart is published at ArtifactHUB - Smarter.
Installation
helm install my-release oci://ghcr.io/smarter-sh/charts/smarter -f my-values.yaml
Examples
# Example values.yaml
app:
replicaCount: 2
workers: 2 # uvicorn worker processes per pod, one per core, about 420 MB each
limitConcurrency: 100 # per worker; uvicorn answers 503 above it
resources:
requests:
cpu: "1"
memory: "1280Mi"
limits:
cpu: "2"
memory: "2Gi"
Links
Configuration
The chart can be configured using the following values:
# ==============================================================================
# Smarter Platform - Helm Chart Values
# ==============================================================================
#
# Default configuration values for the Smarter Platform Helm chart.
#
# This file contains all configurable parameters for deploying the Smarter
# application stack including:
# - Django application server
# - Celery workers and beat scheduler
# - Redis cache
# - Database connections
# - Third-party API integrations
# - OAuth providers
#
# IMPORTANT: Replace all "SET-ME-IN-helm/charts/smarter/values.yaml" values
# with actual credentials before deployment.
#
# Usage:
# helm install smarter . -f values.yaml
# helm upgrade smarter . -f values.yaml
#
# Documentation: https://github.com/smarter-sh/smarter
#
# Note:
# The app.kubernetes.io/application-group label is used to identify pods to Calico
# and kubernetes_network_policy_v1 resources in order to allow pod-level communication
# between backing services. If the label is missing then the network policies are
# assured to PREVENT communication.
# ==============================================================================
# -----------------------------------------------------------------------------
## @param env Environment variables for the Smarter application. If set, these
## are consumed and set automatically in the Smarter app deployment templates.
# -----------------------------------------------------------------------------
env:
AUTHENTICATION_BACKENDS: "social_core.backends.google.GoogleOAuth2,social_core.backends.github.GithubOAuth2,django.contrib.auth.backends.ModelBackend"
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are optional: prefer serviceAccount.awsRoleArn
# (IRSA). Static keys win over the role, so set them only for a cluster without IRSA.
AWS_REGION: "ca-central-1"
CACHES_LOCATION: "SET-ME-IN-helm/charts/smarter/values.yaml"
CELERY_BROKER_URL: "SET-ME-IN-helm/charts/smarter/values.yaml"
CELERY_RESULT_BACKEND: "SET-ME-IN-helm/charts/smarter/values.yaml"
DEBUG_MODE: "false"
DJANGO_SETTINGS_MODULE: "smarter.settings.prod"
DOCKERHUB_PAT: "SET-ME-IN-helm/charts/smarter/values.yaml"
DOCKERHUB_USERNAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
DUMP_DEFAULTS: "False"
ENVIRONMENT: "prod"
NAMESPACE: "smarter-platform-prod"
SECRET_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_ADMIN_EMAIL: "admin@example.com"
SMARTER_ADMIN_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_ADMIN_USERNAME: "admin"
SMARTER_ANTHROPIC_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_AWS_EKS_CLUSTER_NAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_ADDRESS1: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_ADDRESS2: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_CITY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_STATE: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_POSTAL_CODE: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_COUNTRY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_CURRENCY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_TIMEZONE: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_CONTACT_URL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_CORPORATE_NAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_SUPPORT_EMAIL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_PRIMARY_CONTACT: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_SUPPORT_HOURS: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRANDING_SUPPORT_PHONE_NUMBER: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_BRAVE_SEARCH_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_CACHE_EXPIRATION: "60"
SMARTER_CHAT_CACHE_EXPIRATION: "5"
SMARTER_COHERE_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_COHERE_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_EMAIL_ADMIN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_ENABLE_DASHBOARD_SERVER_LOGS: true
SMARTER_ENABLE_MANIFEST_DROPZONE: true
SMARTER_ENABLE_PROXY: true
SMARTER_ENABLE_VECTORSTORE: true
# true: initialize_platform uploads the static files to the environment's S3 bucket on each deployment, and
# pages load them from its CDN, cdn.<platform>. It needs AWS. false: the server serves them.
SMARTER_STATIC_FILES_ON_CDN: false
# The Smarter Extension registry's base64 Ed25519 public key. This is a
# public key, not a secret. An empty value disables the registry.
SMARTER_EXTENSION_REGISTRY_PUBLIC_KEY: "i0kR0g3ZEf6YzyyjnQbIwq85D7QGwTrvzubYsw6sdtg="
SMARTER_EXTENSION_REGISTRY_URL: "https://smarter-sh.github.io/extensions-registry/index.json"
SMARTER_FERNET_ENCRYPTION_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_FIREWORKS_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_GEMINI_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
# Optional. The platform's GitHub token, smarter_settings.github_token: SkillPlugin skill downloads
# (any token), and the bug reports that Smarter Sysadmin opens (a classic ghp_ token with the
# public_repo scope). Without it, create_bug_report says bug reports are not configured.
GITHUB_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_GOOGLE_MAPS_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_GOOGLE_SERVICE_ACCOUNT_B64: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_INTERNAL_IP_PREFIXES: "192.168."
SMARTER_LISTVIEW_CACHE_EXPIRATION: "3600"
SMARTER_LLAMA_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_LLM_CLIENT_CACHE_EXPIRATION: "300"
SMARTER_LLM_CLIENT_TASKS_CELERY_MAX_RETRIES: "3"
SMARTER_LLM_CLIENT_TASKS_CELERY_RETRY_BACKOFF: "True"
SMARTER_LLM_CLIENT_TASKS_CELERY_TASK_QUEUE: "default_celery_task_queue"
SMARTER_INFRASTRUCTURE_TASKS_CELERY_TASK_QUEUE: "infrastructure_celery_task_queue"
SMARTER_LLM_CLIENT_TASKS_CREATE_DNS_RECORD: "True"
SMARTER_LLM_CLIENT_TASKS_CREATE_INGRESS_MANIFEST: "True"
SMARTER_LLM_CLIENT_TASKS_DEFAULT_TTL: "600"
# The Loki of the loki subchart, which the MCPServer's staff-only log tools query.
# Set it to "" with loki.enabled: false.
SMARTER_LOKI_URL: "http://smarter-loki:3100"
SMARTER_LOGIN_URL: "https://platform.example.com/login/"
SMARTER_LOGO: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MAILCHIMP_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MAILCHIMP_LIST_ID: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MARKETING_SITE_URL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MISTRAL_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MYSQL_BACKUP_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml" # the read-only account for the nightly backup. Unset: the backup dumps as root
SMARTER_MYSQL_BACKUP_USERNAME: "smarter_backup"
SMARTER_MYSQL_DATABASE: "smarter_platform_prod"
SMARTER_MYSQL_HOST: "mysql"
SMARTER_MYSQL_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MYSQL_PORT: "3306"
SMARTER_MYSQL_ROOT_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_MYSQL_ROOT_USERNAME: "root"
SMARTER_MCPSERVER_RATE_LIMIT: "1200"
SMARTER_MYSQL_USER: "smarter_platform_prod"
SMARTER_NAMESPACE: "smarter-platform-alpha"
SMARTER_OPENAI_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PINECONE_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBDOMAIN: "platform"
SMARTER_PINECONE_ENVIRONMENT: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLUGIN_MAX_DATA_RESULTS: "50"
SMARTER_ROOT_DOMAIN: "example.com"
SMARTER_S3_BUCKET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SENSITIVE_FILES_AMNESTY_PATTERNS: "^/dashboard/account/password-reset-link/[^/]+/[^/]+/$,^/api(/.*)?$,^/admin(/.*)?$,^/plugin(/.*)?$,^/docs/manifest(/.*)?$,^/docs/json-schema(/.*)?$,.*stackademy.*,^/\\.well-known/acme-challenge(/.*)?$"
SMARTER_SETTINGS_OUTPUT: "false"
# The Slack app's tokens, which only the optional Slack bot reads (slackBot.enabled).
SMARTER_SLACK_APP_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SLACK_BOT_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SMTP_FROM_EMAIL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SMTP_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SMTP_SENDER: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SMTP_USERNAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_GITHUB_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_GITHUB_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_GOOGLE_OAUTH2_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_TAVILY_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_TOGETHERAI_API_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMTP_HOST: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMTP_PORT: "587"
SMTP_USE_SSL: "false"
SMTP_USE_TLS: "true"
# -----------------------------------------------------------------------------
# Global Configuration
# -----------------------------------------------------------------------------
global:
appName: smarter
image:
pullPolicy: Always
repository: lpm0073/smarter
tag: v9999.9999.9999.dev9999
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: node-group
operator: In
values:
- smarter
defaultStorageClass: gp3
imagePullSecrets:
- name: dockerhub-secret
tolerations:
- key: "node-group"
operator: "Equal"
value: "smarter"
effect: "NoSchedule"
# The security contexts of the pods that run the Smarter image: the app, the Celery
# workers, beat and the init job. They run as smarter_user, the user that the Dockerfile
# creates (uid and gid 1000), which reads the image's code through its group. runAsGroup
# must stay 1000: with only runAsUser set, the process's group would be root's, and it
# could not read the code. The root filesystem is read-only; the directories that the
# processes write are emptyDirs (templates/_helpers.tpl, smarter.writableVolumes).
podSecurityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
# -----------------------------------------------------------------------------
# Smarter Application Configuration
# -----------------------------------------------------------------------------
app:
replicaCount: 2
# The number of uvicorn worker processes in each app pod (uvicorn --workers). Each worker
# is a separate Python process that loads all of Django, about 420 MB at rest, and runs
# Python on at most one core at a time, so match it to resources.requests.cpu (one worker
# per core) and grow resources.requests.memory with it. Django's synchronous code runs on
# a thread pool inside each worker, so a worker that waits on an LLM provider keeps
# serving other requests. Capacity beyond that comes from more pods (hpa), not more
# workers per pod.
workers: 2
# The most concurrent connections and tasks that each uvicorn worker accepts
# (uvicorn --limit-concurrency). Above it, uvicorn answers 503 at once instead of
# accepting the request. Without a limit, every request gets its own thread for
# Django's synchronous code, so under load a pod accepts work until it runs out
# of memory and is killed, dropping every request in flight. With a limit, an
# overloaded pod sheds the excess, its CPU and memory stay bounded, and the
# HorizontalPodAutoscaler adds pods. Leave it empty to disable the limit.
limitConcurrency: 100
# Seconds that the web server waits for the platform database to answer a read or
# a write (env SMARTER_DATABASE_READ_TIMEOUT, PyMySQL's read_timeout and
# write_timeout). A query that the database never answers would otherwise hold
# the request's thread forever. Rendered only into the app Deployment, never
# into app.env or the global env map: app.env also reaches the init job and the
# backup job's email container, and the workers, beat and the init job run
# migrations, management commands and tasks that can legitimately take longer
# than a web request. Leave it empty for no timeout.
databaseReadTimeout: 60
# Threads in each uvicorn worker that run streamed chat prompts (env
# SMARTER_PROMPT_THREADS). A prompt holds its thread while it waits on the LLM
# and its tools, so a worker runs this many prompts at once and queues the next
# ones. The pool is the prompts' own, apart from the event loop's default
# executor (6 threads on a 2-vCPU node), where Django renders error pages.
# Keep it below limitConcurrency. Rendered only into the app Deployment: only
# the web server streams prompts. Leave it empty for the default, 32.
promptThreads: 32
resources:
requests:
# One core per uvicorn worker (app.workers).
cpu: "1"
# About 420 MB for each of the 2 uvicorn workers (app.workers), plus headroom for
# the threads and buffers of requests in flight. The scheduler only places a pod
# on a node with this much memory free, and the HorizontalPodAutoscaler measures
# memory utilization against it.
memory: "1280Mi"
limits:
cpu: "2"
memory: "2Gi"
# The RollingUpdate strategy of the app's Deployment. A deploy first adds maxSurge new pods
# on top of the current ones, then replaces up to maxUnavailable old pods at a time. With
# maxUnavailable: 0, it never stops an old pod until a new one is ready, so when no node has
# a free resources.requests.cpu for the extra pod, and the cluster autoscaler can't add a
# node (spot capacity, a node group at its max size), the new pod stays Pending and the
# deploy never finishes. maxUnavailable: 1 lets it stop one old pod to make room, so the
# deploy always completes, with one pod fewer than replicas for a minute or so at worst.
# Keep it at or below app.podDisruptionBudget.maxUnavailable, and hpa.minReplicas above it.
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
extraVolumeMounts: []
# A PodDisruptionBudget that keeps voluntary disruptions (node drains, cluster
# upgrades, Karpenter or cluster-autoscaler consolidation) from evicting more than
# maxUnavailable app pods at a time. See templates/pdb-api.yaml.
podDisruptionBudget:
enabled: true
maxUnavailable: 1
# The api's Deployment, Service, HorizontalPodAutoscaler and PodDisruptionBudget are named
# <appName>-api. They were named <appName> before v0.43.0. Enabled, legacyName also renders a
# twin of each under the old name, and both Services reach both Deployments' pods, so that an
# install upgrading from an older release drops no request while its Ingresses still name the
# old Service. Such an install upgrades once with it enabled, points its Ingresses at
# <appName>-api (smarter-infrastructure's do; the init job retargets every LLMClient's), then
# upgrades again with it disabled, which deletes the twins. See smarter.apiNames in _helpers.tpl.
legacyName:
enabled: false
names:
mysqlName: mysql
mariadbName: mariadb
service:
port: 8000
targetPort: 8000
# Memory requests match what the processes use once they are running, because the
# scheduler places pods by their requests. Requests below real use let it put too many
# pods on one node, which then runs out of memory, and the kubelet evicts the pods that
# use the most memory above their requests. Each Celery worker process loads Django;
# the infrastructure worker used about 1.1Gi with 4 of them, and beat about 380Mi.
worker:
replicaCount: 2
resources:
requests:
cpu: "250m"
memory: "1280Mi"
limits:
cpu: "1"
memory: "2Gi"
# The Celery worker of the infrastructure queue, which deploys, verifies and destroys
# cloud, Kubernetes and DNS resources. See templates/deployment-worker-infrastructure.yaml.
workerInfrastructure:
replicaCount: 1
resources:
requests:
cpu: "250m"
memory: "1280Mi"
limits:
# 2, the minimum that Django settings recommend. Each of its 4 concurrent tasks runs kubectl and
# the aws cli, which are CPU bound while they start, and slowed one another down on 1.
cpu: "2"
memory: "2Gi"
beat:
replicaCount: 1
resources:
requests:
cpu: "100m"
memory: "512Mi"
limits:
cpu: "500m"
memory: "1Gi"
database:
type: mysql # Options: mysql, mariadb, external
## @param deployTimestamp Deployment timestamp for forcing pod restarts
deployTimestamp: ""
deployment:
containerPort: 8000
# -----------------------------------------------------------------------------
# Horizontal Pod Autoscaler Configuration
# ----------------------------------------------------------------------------
# minReplicas, targetMemoryUtilizationPercentage and behavior apply to the app's
# HorizontalPodAutoscaler (templates/hpa-api.yaml); maxReplicas and
# targetCPUUtilizationPercentage apply to it and to the Celery worker's
# (templates/hpa-worker.yaml).
hpa:
minReplicas: 3
maxReplicas: 25
targetCPUUtilizationPercentage: 75
# Measured against app.resources.requests.memory. The 2 uvicorn workers of an idle
# pod already use about 66% of their 1280Mi request, and Python rarely returns memory
# to the operating system, so a lower target would keep the app scaled out after
# the load is gone. Leave it empty to scale on CPU only.
targetMemoryUtilizationPercentage: 90
# Rendered as the autoscaling/v2 spec.behavior of the app's HorizontalPodAutoscaler.
# Scale up by up to 100% a minute; scale down only after 5 minutes of lower load.
behavior:
scaleUp:
stabilizationWindowSeconds: 60
selectPolicy: Max
policies:
- type: Percent
value: 100
periodSeconds: 60
scaleDown:
stabilizationWindowSeconds: 300
selectPolicy: Min
policies:
- type: Percent
value: 100
periodSeconds: 60
# -----------------------------------------------------------------------------
# Backing Services Configuration
# -----------------------------------------------------------------------------
databaseInit:
# post-install/post-upgrade Job: create db + user, migrate, initialize platform. Also a pre-upgrade Job
# that migrates before the rollout (job-migrate.yaml), so that new pods never run without their schema.
enabled: true
notifyEmail: "" # the Job emails its log here when it completes. Empty: smarter_settings.email_admin
# the Slack channel, e.g. smarter, that the Job also posts its outcome to, with its log in the message's
# thread. Empty: don't post. Needs env.SMARTER_SLACK_BOT_TOKEN, and a bot with the scopes chat:write and
# files:write that is a member of the channel.
notifySlackChannel: ""
databaseScheduledBackup:
enabled: true
schedule: "0 2 * * *" # Every day at 2am UTC
notifyEmail: "" # the Job emails the backup's result and log here. Empty: smarter_settings.email_admin
# the Slack channel, e.g. smarter, that the Job also posts the backup's result to, with its log in the
# message's thread. Empty: don't post. Needs env.SMARTER_SLACK_BOT_TOKEN, and a bot with the scopes
# chat:write and files:write that is a member of the channel.
notifySlackChannel: ""
# where backups are uploaded, e.g. s3://my-private-bucket/backups/sql. Empty: s3://<env.SMARTER_S3_BUCKET>/backups/sql.
# Use a private bucket: the backup is a full copy of the database. The environment bucket that
# serves static assets is often public-read, so don't rely on the default there.
s3Uri: ""
awsCliVersion: "" # the AWS CLI release to install. Empty: the version pinned in configmap-debian-setup.yaml
# the IAM role (IRSA) of the backup's ServiceAccount, smarter-backup, which only needs s3:PutObject on
# s3Uri. smarter-infrastructure creates one per environment. Empty: the AWS keys in env, if any.
awsRoleArn: ""
# -----------------------------------------------------------------------------
# The platform's ServiceAccount (templates/serviceaccount.yaml, templates/rbac.yaml)
# -----------------------------------------------------------------------------
# The app, the Celery workers, beat and the init job run as the smarter ServiceAccount.
# kubectl authenticates as it, with the Role and ClusterRole in templates/rbac.yaml.
serviceAccount:
# the IAM role (IRSA) that the pods use for Route53, ACM, EKS node groups and S3, e.g.
# arn:aws:iam::<account>:role/<namespace>-smarter. smarter-infrastructure creates one per
# environment. Empty: the pods use env.AWS_ACCESS_KEY_ID and env.AWS_SECRET_ACCESS_KEY.
awsRoleArn: ""
# create the ServiceAccount's read-only ClusterRole (nodes, PersistentVolumes, node metrics), which
# needs a deployer with cluster-wide permissions. smarter-sh's own deploy workflow turns it off,
# because smarter-infrastructure creates the same ClusterRole, so that each environment deploys with
# namespace-scoped permissions only. See templates/rbac.yaml.
createClusterRole: true
# -----------------------------------------------------------------------------
# Optional Slack bot (the slack-bot subchart, helm/charts/slack-bot)
# -----------------------------------------------------------------------------
# A single pod that answers questions in a Slack workspace with a deployed
# LLMClient, through its chat api. It connects to Slack with Socket Mode, so it
# needs no Ingress. It reads env.SMARTER_SLACK_BOT_TOKEN and
# env.SMARTER_SLACK_APP_TOKEN. Enable it in one environment only: two bots with
# the same Slack app would each receive part of the messages. The deploy workflow
# enables it in prod only, when the repository secrets SLACK_BOT_TOKEN,
# SLACK_APP_TOKEN and SLACK_BOT_AGENT_URL are set.
# See helm/charts/slack-bot/values.yaml for the other values.
slackBot:
enabled: false
# The deployed LLMClient that answers, e.g.
# https://smarter-developer.<account-number>.api.<root-domain>/. Required when enabled.
agentUrl: ""
externalDatabase:
host: "" # Will use .Values.env.SMARTER_MYSQL_HOST if empty
port: 3306 # Will use .Values.env.SMARTER_MYSQL_PORT if empty
database: "" # Will use .Values.env.SMARTER_MYSQL_DATABASE if empty
username: "" # Will use .Values.env.SMARTER_MYSQL_USER if empty
password: "" # Will use .Values.env.SMARTER_MYSQL_PASSWORD if empty
mysql:
enabled: false
nameOverride: "mariadb" # every resource becomes <release>-mariadb = smarter-mariadb
primary:
# Smarter stores emoji and other 4-byte characters (prompts, manifests,
# chat history), which need utf8mb4. The Bitnami chart's default my.cnf sets
# character-set-server=UTF8, which is the 3-byte utf8mb3. Command-line flags
# take precedence over my.cnf.
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
containerSecurityContext:
enabled: true
runAsUser: 1001
runAsGroup: 1001
fsGroup: 1001
image:
pullPolicy: Always
initdbScripts: {}
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
nodeSelector: {}
persistence:
enabled: true
size: 8Gi
storageClassName: "gp3"
accessModes:
- ReadWriteOnce
podSecurityContext:
enabled: true
fsGroup: 1001
resources:
requests:
memory: "1Gi"
cpu: "250m"
limits:
memory: "2Gi"
cpu: "1"
readinessProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
mariadb:
enabled: true
nameOverride: "mariadb" # every resource becomes <release>-mariadb = smarter-mariadb
# Bitnami publishes bitnami/mariadb only as `latest`, so a version tag can't be pinned. The
# digest pins the image, so that a pod rescheduled onto a new node runs the same MariaDB as
# before, and never a new major version against the existing data directory. A digest
# replaces the tag in the pod's image reference. This one is MariaDB 13.1.1 (amd64 and arm64).
# To upgrade, take the digest of the new `latest`, e.g. with
# `docker buildx imagetools inspect bitnami/mariadb:latest`.
image:
digest: "sha256:687181819d6e3f04124a21aec1aeef1d8a5d6a924c0d8e8f0cf66b8f0ce15a7c"
primary:
# MariaDB is one pod on a ReadWriteOnce volume, so any eviction is a database outage of
# about a minute, while the new pod waits for the volume to detach from the old node
# (issue #931, as for Redis in #929). This annotation stops the cluster autoscaler from
# scaling down MariaDB's node.
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
# The chart's default PodDisruptionBudget is maxUnavailable: 1, which allows evicting the
# only pod. minAvailable: 1 blocks every voluntary eviction. A node drain, or a managed node
# group upgrade, then waits for an operator to delete the pod by hand, at a time they choose.
pdb:
create: true
minAvailable: 1
maxUnavailable: ""
# Smarter stores emoji and other 4-byte characters (prompts, manifests,
# chat history), which need utf8mb4. The Bitnami chart's default my.cnf sets
# character-set-server=UTF8, which is the 3-byte utf8mb3. Command-line flags
# take precedence over my.cnf. The init Job also creates the database, or
# alters it, with utf8mb4 as its default.
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
cpu: 2
memory: 4Gi
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
# The annotation and the PodDisruptionBudget above stop only voluntary evictions. A spot node
# that AWS reclaims takes MariaDB with it, whatever they say (issue #942: every node was spot,
# and MariaDB went down when its node was replaced). On a cluster with an on-demand node group,
# pin MariaDB to it, e.g. on EKS:
# nodeSelector:
# eks.amazonaws.com/capacityType: ON_DEMAND
# Leave it empty while every node is spot, or the pod can't be scheduled.
nodeSelector: {}
readinessProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
persistence:
enabled: true
size: 8Gi
storageClass: "gp3"
accessModes:
- ReadWriteOnce
# -----------------------------------------------------------------------------
# Redis Configuration
# -----------------------------------------------------------------------------
redis:
enabled: true
external:
host: ""
port: 6379
password: ""
fullnameOverride: "smarter-redis"
auth:
enabled: true
password: "smarter"
architecture: standalone
# Bitnami publishes bitnami/redis only as `latest`, so a version tag can't be pinned. The
# digest pins the image, so that a restarted pod runs the same Redis as before. A digest
# replaces the tag in the pod's image reference. This one is Redis 8.10.3 (amd64 and arm64).
# To upgrade, take the digest of the new `latest`, e.g. with
# `docker buildx imagetools inspect bitnami/redis:latest`.
image:
digest: "sha256:59078af5aec997137eb95f34fed376487b471e05c9a244c2812a13598c434950"
master:
disableCommands: []
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
# Redis is one pod on a ReadWriteOnce volume, so any eviction is an outage of about a
# minute, while the new pod waits for the volume to detach from the old node (issue #929).
# This annotation stops the cluster autoscaler from scaling down Redis's node.
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
# The chart's default PodDisruptionBudget is maxUnavailable: 1, which allows evicting the
# only pod. minAvailable: 1 blocks every voluntary eviction. A node drain, or a managed node
# group upgrade, then waits for an operator to delete the pod by hand, at a time they choose.
pdb:
create: true
minAvailable: 1
maxUnavailable: ""
# As for MariaDB: a reclaimed spot node takes Redis with it (issue #942). On a cluster with an
# on-demand node group, pin Redis to it, e.g. on EKS:
# nodeSelector:
# eks.amazonaws.com/capacityType: ON_DEMAND
# Leave it empty while every node is spot, or the pod can't be scheduled.
nodeSelector: {}
containerSecurityContext:
enabled: true
persistence:
enabled: true
size: 10Gi
storageClass: gp3
podSecurityContext:
enabled: true
resources:
requests:
cpu: "250m"
memory: "2Gi"
limits:
cpu: "1"
memory: "4Gi"
service:
headless:
sessionAffinity: None
replica:
disableCommands: []
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
# ----------------------------------------------------------------------------
# Monitoring Components
# Enable/disable and configure Prometheus, Grafana, and Loki
# ----------------------------------------------------------------------------
prometheus:
enabled: false
server:
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
persistentVolume:
enabled: false # For demo/dev. Set to true and configure storage for production.
grafana:
enabled: false
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
adminPassword: "admin" # Change for production!
persistence:
enabled: false # For demo/dev. Set to true and configure storage for production.
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus-server
- name: Loki
type: loki
access: proxy
url: http://smarter-loki:3100
# ----------------------------------------------------------------------------
# Pod logs: Loki stores them, Alloy collects them
# ----------------------------------------------------------------------------
# The last 72 hours of the logs of the app, the Celery workers, beat and MariaDB,
# which the Smarter MCP Server's log tools search (smarter.apps.mcpserver.services.logs).
#
# - Loki runs as one pod (deploymentMode SingleBinary) with its chunks and index on
# its own gp3 volume. Nothing is sent to S3 or CloudWatch, which would add cost.
# Its compactor deletes logs older than limits_config.retention_period.
# - Alloy runs as one pod, not a DaemonSet on every node. loki.source.kubernetes
# tails the logs through the Kubernetes api, so Alloy needs no host paths, and
# reads only its own namespace, with the Role in templates/role-alloy.yaml. Its
# own ClusterRole and CRDs are off: the cluster is shared by every environment,
# and two releases would each claim the same cluster-wide objects.
# - Alloy redacts email addresses, IP addresses, tokens, api keys and passwords
# before a line is stored (loki.process "redact"). A failed sign-in is logged
# with a hash of the email address instead (smarter.apps.account.login_audit).
# - Both pods carry the application-group label, so the namespace's network
# policies admit them. The application group's egress policy must allow TCP 3100
# to Loki (smarter-infrastructure, aws/terraform/kubernetes/network_policy.tf).
# - Loki has no authentication (auth_enabled: false). Only pods in the namespace
# can reach it, and it has no Service outside the cluster.
loki:
enabled: true
fullnameOverride: "smarter-loki"
deploymentMode: SingleBinary
# a Role in this namespace, not a ClusterRole: every environment's release is named
# smarter, and they would each claim the same cluster-wide smarter-loki-clusterrole.
rbac:
namespaced: true
loki:
auth_enabled: false
commonConfig:
replication_factor: 1
# one pod: no memberlist ring, whose port the network policies don't open.
ring:
kvstore:
store: inmemory
storage:
type: filesystem
schemaConfig:
configs:
- from: "2026-11-01"
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: loki_index_
period: 24h
limits_config:
retention_period: 72h
# Alloy can resend lines after a restart; older ones are already deleted.
reject_old_samples_max_age: 72h
max_query_lookback: 72h
compactor:
retention_enabled: true
delete_request_store: filesystem
pattern_ingester:
enabled: false
ui:
enabled: false
singleBinary:
replicas: 1
podLabels:
app.kubernetes.io/application-group: "smarter"
persistence:
enabled: true
size: 10Gi
storageClass: gp3
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 1Gi
# the other deployment modes' components, and the extras that SingleBinary doesn't need.
backend:
replicas: 0
read:
replicas: 0
write:
replicas: 0
gateway:
enabled: false
chunksCache:
enabled: false
resultsCache:
enabled: false
lokiCanary:
enabled: false
test:
enabled: false
minio:
enabled: false
sidecar:
rules:
enabled: false
alloy:
enabled: true
fullnameOverride: "smarter-alloy"
crds:
create: false
# templates/role-alloy.yaml grants the service account a Role in this namespace.
rbac:
create: false
serviceAccount:
create: true
name: smarter-alloy
controller:
type: deployment
replicas: 1
podLabels:
app.kubernetes.io/application-group: "smarter"
alloy:
enableReporting: false
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
configMap:
# Alloy's configuration language. The chart passes it through tpl, so Helm
# expressions work, and Alloy's own braces need no escaping.
content: |
// The pods of the app, the Celery workers, beat and MariaDB, in this namespace only.
discovery.kubernetes "pods" {
role = "pod"
namespaces {
own_namespace = true
}
selectors {
role = "pod"
label = "app.kubernetes.io/name in ({{ .Values.global.appName }},{{ .Values.global.appName }}-api,{{ .Values.global.appName }}-worker,{{ .Values.global.appName }}-worker-infrastructure,{{ .Values.global.appName }}-beat,mariadb)"
}
}
// The labels that the MCP Server's queries select on: component, pod and container.
discovery.relabel "pods" {
targets = discovery.kubernetes.pods.targets
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_label_app_kubernetes_io_name"]
target_label = "component"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "pod"
}
rule {
source_labels = ["__meta_kubernetes_pod_container_name"]
target_label = "container"
}
}
loki.source.kubernetes "pods" {
targets = discovery.relabel.pods.output
forward_to = [loki.process.redact.receiver]
}
// Each stage.replace replaces what its expression's capture group matched.
// Alloy's expressions are RE2: no lookahead or lookbehind. They are tested by
// helm/charts/smarter/tests/test_alloy_redact.py, which reads them from this file.
loki.process "redact" {
stage.replace {
expression = "([\\w.+-]+@[\\w-]+\\.[\\w.-]+)"
replace = "<email>"
}
stage.replace {
expression = "\\b((?:\\d{1,3}\\.){3}\\d{1,3})\\b"
replace = "<ip>"
}
// A token, but not code that calls something, e.g. the traceback source line
// stored_token = self.redis.get(self.name): the value must not run into a "(".
// The word must not end a longer word, e.g. "SmarterAuthToken <name>" (#971).
stage.replace {
expression = "(?i)(?:^|[^a-z])(?:bearer|token)[\"' :=]+([A-Za-z0-9._~+/-]{12,})(?:[^A-Za-z0-9._~+/(-]|$)"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(sk-[A-Za-z0-9_-]{20,})"
replace = "<redacted>"
}
stage.replace {
expression = "\\b((?:AKIA|ASIA)[A-Z0-9]{16})\\b"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(gh[pousr]_[A-Za-z0-9]{30,}|xox[abposr]-[A-Za-z0-9-]{10,})"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})"
replace = "<redacted>"
}
// A password or api key, and the password of a url, but not a value that Smarter
// already masked: mask_string() and SqlConnection.get_connection_string() write
// masks that start with "*", e.g. "api_key": "****abcd" and mysql://user:******@host.
// The word must not end a longer word, e.g. "tokenSecret": "<name>", which names a
// Smarter Secret (#990). A JSON null, true or false is matched outside the capture
// group, which stage.replace then leaves as it is, e.g. "apiKeySecret": null.
stage.replace {
expression = "(?i)(?:^|[^a-z])(?:password|passwd|secret|api_key|apikey)[\"']?\\s*[:=]\\s*(?:(?:null|true|false)(?:[\\s,}\\]]|$)|[\"']?([^\\s\"',}*][^\\s\"',}]{3,}))"
replace = "<redacted>"
}
stage.replace {
expression = "://[^:/\\s]+:([^@\\s*][^@\\s]*)@"
replace = "<redacted>"
}
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://smarter-loki.{{ .Release.Namespace }}.svc.cluster.local:3100/loki/api/v1/push"
}
}