nscale AI#
nscale AI adds chat with a document, summaries and automatic enrichment to nscale. In nplus it consists of four components, each with its own switch in the instance, plus an optional fifth, the MCP server of the Application Layer. All of them are off by default:
| Component | Switch | What it is |
|---|---|---|
aisearch | components.aisearch | the Elasticsearch instance (an ECK Elasticsearch resource, optionally Kibana) |
aibackend | components.aibackend | the API: talks to the language model and to Elasticsearch, served on /ai-api |
aiauth | components.aiauth | an oauth2-proxy that checks every API request against your identity provider, served on /oauth2 |
aichat | components.aichat | the user interface: chat on /ai/chat, summary on /ai/chat/summary, compatibility entry /ai/short |
aimcp | components.aimcp | optional: the MCP server of the Application Layer (see below), internal only, no ingress |
Everything is published on the instance domain (global.ingress.domain), next to the other components,
with all three ingress providers (ingress, traefik, gateway). The instance domain takes the role of
the backend host of the Ceyoniq installation, so the Application Layer forwards its AI requests there.
Prerequisites#
the ECK operator (
elastic/eck-operator) in the cluster, it runs Elasticsearchthe Prometheus Operator CRDs, only if you set
aibackend.monitoring.enabled: truea pull secret for
registry.source.ceyoniq.com, by default namednscale-ai-cr:kubectl create secret docker-registry nscale-ai-cr -n <namespace> \ --docker-server=registry.source.ceyoniq.com \ --docker-username=<tokenname> --docker-password=<token>an identity provider (Entra ID, Keycloak, Zitadel, …) with the redirect url
https://<instance domain>/oauth2/callbacka language model and an embedding model with an OpenAI compatible API
Credentials follow the same rule as everywhere in nplus (compare the database or the Application Layer credentials): a secret or a value. If both are set, the secret wins.
| What | Secret (production) | Value (tests only) |
|---|---|---|
| API key of the language model | aibackend.ai.connections[].bearerTokenRef (name of the secret, key within it) | aibackend.ai.connections[].bearerToken |
| API key of the embedding model | aibackend.ai.embedding.bearerTokenRef | aibackend.ai.embedding.bearerToken |
| Client and cookie secret of the login | aiauth.auth.clientSecretRef, aiauth.auth.cookieSecretRef | - |
A value stands in the manifest and therefore in your Git repository, in the Helm release and in the Argo CD
application. Use the secret for everything you keep. This sample references the secrets ki-llm (key token)
and ki-oauth, so create them first and only reference them:
kubectl create secret generic ki-llm -n <namespace> --from-literal=token='<api key>'
kubectl create secret generic ki-oauth -n <namespace> \
--from-literal=client-secret='<client secret>' \
--from-literal=cookie-secret="$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '=')"For tests you can let your own setup script create them, so that no key ever lands in a values file. Our
test environments do exactly that: the script that sets up the environment (namespace, pull secrets, license)
also creates ki-llm from a local configuration file of that environment, and the instance only references it.
Switching it on#
values.yaml switches the four components on and sets models, identity provider and secret references. Stack it on top of your environment:
helm upgrade -i demo nplus/nplus-instance \
--values samples/environment/<context>.yaml \
--values samples/ai/values.yamlcomponents.aiauth and aibackend.auth.enabled belong together: the first deploys the login, the second
makes the API route ask it. The instance refuses to render if they differ. Without authentication the API is
open to everyone who reaches the ingress - only acceptable in an isolated test setup. The gateway provider
cannot ask the login and therefore refuses aibackend.auth.enabled.
Former host names#
The Ceyoniq installation used three host names (backend., chat-ui., short-ui.<domain>). If web clients
still use the chat or short host, add them with hosts.yaml: the chat UI is then served on these
hosts as well, each with its own certificate.
Scaling#
The AI components aibackend, aichat and aiauth support the standard replicaCount and the hard pod
anti-affinity of nplus, so every replica needs a node of its own. Elasticsearch (aisearch) is the exception:
its pods only prefer different nodes (best effort), so that it also starts where there are fewer nodes than
Elasticsearch nodes, for example on two sites. See the
high availability sample for what that means for the quorum.
- aichat, aiauth and aimcp are stateless and can run with
replicaCount: 2or more (aimcpwithmcp.protocol: STATELESS, see below). The oauth2-proxy keeps the session in the cookie, all replicas share the cookie secret. - aibackend is stateless (its data lives in Elasticsearch) and can run with
replicaCount: 2or more; Ceyoniq confirmed this on 15 October 2026 and runs two itself. One thing to know on a fresh installation: when several pods start at the same time, they all try to create the indices, and all but one end up in an error state until they are restarted. Start withreplicaCount: 1and scale up afterwards, or start the pods one after the other. An update withmaxUnavailable: 0is not affected. - aisearch: high availability means
aisearch.elasticsearch.count: 3(a quorum of master eligible nodes) plus replica shards for the indices. Elasticsearch creates indices with one replica, so the cluster isgreenwith three nodes andyellowwith one (the replicas have nowhere to go, which is fine for a test). The high availability sample describes what the three nodes need.
Monitoring#
aibackend.monitoring.enabled: true renders a ServiceMonitor and two PrometheusRules that alert on
dropped chat messages and dropped summaries.
For health checks from outside use the readiness of the backend (/ai-api/actuator/health/readiness), as the
probes of the pod do. The summary /ai-api/actuator/health reports OUT_OF_SERVICE as long as aibackend.ai.sentryDsn
is empty, because its Sentry check has nothing to report to; the Ceyoniq chart leaves the DSN empty as well. Liveness
and readiness are not affected.
Reaching the language model#
The pods of aibackend call the language model themselves, so the endpoint of ai.connections[].url and of
ai.embedding.url must be reachable from the pods: the name must resolve in the cluster and the certificate must
be trusted by the backend. If your endpoint sits behind a certificate of your own CA, check that the backend
accepts it before you rely on it, an unreachable model shows as failed chats, not as a failed deployment.
Network policies#
With security.cni.createNetworkPolicy: true the four AI components get their own NetworkPolicy, like every other
component, and so does aimcp if it is switched on. Together with a default deny (defaultIngressPolicy: deny,
defaultEgressPolicy: deny) they open exactly these paths inside the instance:
| From | To | Why |
|---|---|---|
| ingress controller | aichat, aiauth, aibackend | the user interface, the sign-in and the API on the instance domain |
aichat, aiauth | aibackend | the user interface and the oauth2-proxy forward their calls |
aibackend | aisearch | Elasticsearch |
aibackend | aimcp | tool calls of the language model |
aibackend, aimcp | nappl | the Application Layer (the policy of nappl accepts both) |
nappl | ingress controller | the Application Layer sends its AI requests to the instance domain, through the ingress controller (namespaces from ingress.namespace) |
aisearch | aisearch | the nodes of the Elasticsearch cluster, on all ports (the transport port 9300 is not a port of the component) |
| ECK operator | aisearch | the operator checks and sets up the cluster; its namespace is security.cni.elasticOperatorNamespace, default elastic-system |
Two ways lead out of the cluster and cannot be derived from the instance, so they stay closed until you name the address range:
global:
security:
cni:
llmIpRange: 10.18.5.20/32 # the language model (ai.connections[].url, ai.embedding.url)
idpIpRange: 10.20.0.0/24 # the identity provider of aiauth (auth.oidcIssuerUrl)Without llmIpRange the chat fails with a connection error, without idpIpRange the sign-in at the identity
provider does. A model or identity provider inside the cluster needs no range, but a rule of your own, because its pods
are not part of the instance. The Prometheus that reads the ServiceMonitor of aibackend.monitoring also lives
outside the instance: allow it with a policy of your own, the chart opens nothing for it.
A rule counts for new connections. Pods that still hold a connection to the language model keep using it after you
removed the range, until they are restarted (checked in the nplus lab with default deny on both directions: after a
restart of aibackend the chat failed with 500 within seconds, with the range it worked again).
MCP server of the Application Layer#
With components.aimcp: true the instance runs the Application Layer MCP server (image nscale-ai/applicationlayer-mcp-server,
port 8081). It lets the language model call the REST endpoints of the Application Layer as tools. The server needs no
sign-in of its own: the requests of the nscale clients always pass the Application Layer, which authenticates them.
The component is only a pod and a service. It has no ingress and no probes (the image documents no health endpoint,
and /mcp answers 401 without credentials, so an HTTP probe would fail). aibackend does not use it until you tell it so
under aibackend.ai.mcp.servers. Every key of an entry is handed to the backend as KI_MCP_SERVERS_<n>_<KEY>, the service of
the component is <prefix>aimcp on port 8081. The example of Ceyoniq names the server and gives its address:
components:
aimcp: true
aibackend:
ai:
mcp:
servers:
- name: nappl-mcp
url: http://<prefix>aimcp.<namespace>:8081The key names are those of the nscale AI backend; the administrative documentation of Ceyoniq is announced. The backend
appends /mcp itself, so the address carries no path.
The MCP server in turn calls the REST endpoints of the Application Layer (AL_REST_SERVER_URL). In an instance it takes
host, port, ssl and instance from global.nappl, so it talks to http://<prefix>nappl.<namespace>:8080/nscalealinst1/rest
without further settings; aimcp.nappl.url sets the address as a whole. Without it the image falls back to localhost,
which does not answer in a pod: every MCP request then fails with 503, and the backend logs that it could not discover
the tools. The timeouts towards the Application Layer, the longest answer handed to the model and the check of the
caller’s sign-in are values of the component as well (aimcp.nappl.*, aimcp.mcp.auth.*).
In the nplus lab (10.3.1001, instance ha) the backend reaches the server with this entry, and the server checks the
caller against the Application Layer (/whoami).
More than one replica: by default the server keeps the session of a client in the memory of the pod that opened
it (Mcp-Session-Id). A request that reaches another pod is answered with 404 Session not found, which shows as
sporadic failures of tool calls behind a service with several pods. Set aimcp.mcp.protocol: STATELESS then: no
session is issued, every pod answers every request (checked in the nplus lab with two aimcp pods and two
Application Layer pods, 12 tool calls in a row, all answered). The high availability sample sets it.
What the image does (checked in the nplus lab with 10.3.1000): it is a Spring Boot application that serves the MCP
endpoint on /mcp (streamable HTTP, port 8081), registers 136 tools and 27 resources, and starts as user 1001 with a
read-only root file system, like every other nplus component. A request without the nscale authorization of the caller
is refused with 401 (This MCP endpoint requires the caller's nscale authorization.): the server holds no credentials of
its own, it passes on the sign-in of the client.
Files#
Download all files of this sample
build.sh#
#!/bin/bash
#
# This sample script builds the example as described. It is also used to build the test environment in our lab,
# so it should be well tested.
#
# Make sure it fails immediately, if anything goes wrong
set -e
# -- ENVironment variables:
# CHARTS: The path to the source code
# DEST: The path to the build destination
# SAMPLE: The directory of the sample
# NAME: The name of the sample, used as the .Release.Name
# KUBE_CONTEXT: The name of the kube context, used to build this sample depending on where you run it against. You might have different Environments such as lab, dev, qa, prod, demo, local, ...
# Check, if we have the source code available
if [ ! -d "$CHARTS" ]; then
echo "ERROR Building $SAMPLE example: The Charts Sources folder is not set. Please make sure to run this script with the full Source Code available"
exit 1
fi
if [ ! -d "$DEST" ]; then
echo "ERROR Building $SAMPLE example: DEST folder not found."
exit 1
fi
if [ ! -d "$CHARTS/instance" ]; then
echo "ERROR Building $SAMPLE example: Chart Sources in $CHARTS/instance not found. Are you running this script as a subscriber?"
exit 1
fi
# Set the Variables
SAMPLE="ai"
NAME="sample-$SAMPLE"
# Output what is happening
echo "Building $NAME"
# Create the manifest
mkdir -p $DEST/instance
helm template --debug \
--values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
--values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
--values $SAMPLES/ai/values.yaml \
--values $SAMPLES/ai/hosts.yaml \
$NAME $CHARTS/instance > $DEST/instance/$SAMPLE.yamlhosts.yaml#
# Optional: keep the former host names of the Ceyoniq installation working,
# for web clients that still use chat-ui.<domain> or short-ui.<domain>.
# Both names need a DNS entry pointing to your ingress controller.
aichat:
hosts:
- host: chat-ui.example.com
secret: chat-ui-ingress-tls
- host: short-ui.example.com
secret: short-ui-ingress-tlsnplus-lab.yaml#
# nscale AI in the nplus lab (s14p1, context nplus-lab).
#
# Stack it on top of the lab environment when deploying an instance:
#
# helm upgrade -i demo -n nplus-lab charts/instance \
# --values samples/postgres/values.yaml \
# --values samples/traefik/native.yaml \
# --values samples/environment/nplus-lab.yaml \
# --values samples/ai/nplus-lab.yaml \
# --values versions/10.3.1001.yaml
#
# Prerequisites before the first deploy:
#
# kubectl -n nplus-lab create secret generic ki-llm \
# --from-literal=token='<api key>'
# kubectl -n nplus-lab create secret generic ki-oauth \
# --from-literal=client-secret='<client secret>' \
# --from-literal=cookie-secret='<cookie secret>'
#
# The URLs and the OIDC issuer below are placeholders — replace them with the
# endpoint the lab actually talks to. The values are identical to
# samples/ai/values.yaml except that all four components are on and the model
# mapping is set for a 10.3 test license.
components:
# -- the AI components are off by default, this switches them on
aisearch: true
aibackend: true
aiauth: true
aichat: true
aibackend:
auth:
# -- keep identical to components.aiauth
enabled: true
ai:
connections:
- url: "https://llm.example.com/v1"
type: EXTERNAL
bearerTokenRef:
name: ki-llm
key: token
modelToFeature:
- feature: CHAT
model: "gpt-4.1"
maxTokenCount: 25
- feature: SUMMARIZE
model: "gpt-4.1"
maxTokenCount: 25
- feature: SHORT_SUMMARIZE
model: "gpt-4.1-mini"
maxTokenCount: 25
- feature: ENRICHMENT
model: "gpt-4.1-mini"
maxTokenCount: 25
embedding:
model: "text-embedding-3-small"
dimension: 1536
url: "https://llm.example.com/v1"
bearerTokenRef:
name: ki-llm
key: token
timezone: "Europe/Berlin"
aiauth:
auth:
provider: oidc
oidcIssuerUrl: "https://login.example.com/realms/nscale"
clientId: "nscale-ai"
clientSecretRef:
name: ki-oauth
key: client-secret
cookieSecretRef:
name: ki-oauth
key: cookie-secret
scope: "openid profile email"values.yaml#
# nscale AI in an nplus instance.
# Stack it on top of your environment file, e.g.
# helm template demo charts/instance -f samples/environment/lab.yaml -f samples/ai/values.yaml
components:
# -- the AI components are off by default, this switches them on
aisearch: true
aibackend: true
aiauth: true
aichat: true
aibackend:
auth:
# -- keep identical to components.aiauth
enabled: true
ai:
# The API keys come from the secret `ki-llm` (key `token`), see README.md. For a quick test you can set
# `bearerToken: <key>` next to `bearerTokenRef` instead, but then the key stands in this file.
connections:
- url: "https://llm.example.com/v1"
type: EXTERNAL
bearerTokenRef:
name: ki-llm
key: token
modelToFeature:
- feature: CHAT
model: "gpt-4.1"
maxTokenCount: 25
- feature: SUMMARIZE
model: "gpt-4.1"
maxTokenCount: 25
- feature: SHORT_SUMMARIZE
model: "gpt-4.1-mini"
maxTokenCount: 25
- feature: ENRICHMENT
model: "gpt-4.1-mini"
maxTokenCount: 25
embedding:
model: "text-embedding-3-small"
dimension: 1536
url: "https://llm.example.com/v1"
bearerTokenRef:
name: ki-llm
key: token
timezone: "Europe/Berlin"
aiauth:
auth:
provider: oidc
oidcIssuerUrl: "https://login.example.com/realms/nscale"
clientId: "nscale-ai"
clientSecretRef:
name: ki-oauth
key: client-secret
cookieSecretRef:
name: ki-oauth
key: cookie-secret
scope: "openid profile email"