Examples
Nemo Guardrails Service Account
Sends the pod's service account token on Praxis's calls to NeMo, so kube-rbac-proxy can decide whether Praxis is allowed to call
Category: Setup-dependent integration
Task: Sends the pod’s service account token on Praxis’s calls to NeMo, so kube-rbac-proxy can decide whether Praxis is allowed to call
Prerequisites: The external service, credentials, or certificates referenced by this configuration.
Run it: Use ghcr.io/praxis-proxy/ai:0.12.1 and follow the container quickstart to mount and start the configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
Companion resources from the same snapshot:
# Guardrails (TrustyAI NeMoGuardrails) with a Kubernetes service account token
#
# Sends the pod's service account token on Praxis's calls to NeMo, so
# kube-rbac-proxy can decide whether Praxis is allowed to call. The other NeMo
# examples, nemo-guardrails.yaml and nemo-guardrails-response.yaml, call NeMo
# with no service account token.
#
# The TrustyAI Service operator puts kube-rbac-proxy in front of NeMo. The proxy
# checks the service account token, then passes the request on. Praxis sends that token
# only on the call to the provider address below. In production that address
# is the proxy.
#
# In production, set that address to https://. An http:// address is refused
# unless the host is loopback, so the token is not sent where other pods
# can read it.
#
# Set provider.tls.ca_file to the PEM file of whoever signed the proxy
# certificate. Without that file, an https call trusts the file in
# SSL_CERT_FILE, or the directory in SSL_CERT_DIR, when one of those is set.
# Otherwise it trusts the computer's usual list. On OpenShift the signer is
# the service CA. Mount that bundle into the pod and point ca_file, or one
# of those variables, at it. This example stays on http://127.0.0.1 because
# it talks to a local stand-in.
#
# Add this to your Pod spec to mount the token:
#
# volumes:
# - name: nemo-token
# projected:
# sources:
# - serviceAccountToken:
# path: token
# expirationSeconds: 3600 # Kubernetes rotates before expiry
# containers:
# - volumeMounts:
# - name: nemo-token
# mountPath: /var/run/secrets/tokens/nemo
# readOnly: true
listeners:
- name: gateway
address: "0.0.0.0:8080"
filter_chains:
- nemo-guardrails
filter_chains:
- name: nemo-guardrails
filters:
# Publishes the trusted protocol and operation identity for guardrails.
- filter: ai_operation
- filter: ai_guardrails
outbound_chain: nemo-outbound
provider:
type: nemo
# Requires NeMo Guardrails 0.24.0 or newer.
# Local stand-in. In production use https:// and the proxy's host.
# This is the address Praxis calls, and the only place the service
# account token is sent. An http:// address is refused unless the host is
# loopback. See the comment at the top for how Praxis trusts the
# proxy's certificate.
endpoint: "http://127.0.0.1:3001/v1/checks"
# Mounted projected ServiceAccount token. Read at startup and
# refreshed when Kubernetes rotates the file.
token_file: /var/run/secrets/tokens/nemo/token
guardrails:
config_ids: ["your-config"] # replace with a configuration deployed in NeMo
timeout_ms: 5000
max_message_checks: 32
phase:
request: true
response: false
- filter: router
routes:
- path_prefix: "/"
cluster: provider
- filter: load_balancer
clusters:
- name: provider
endpoints:
- "127.0.0.1:3000"
# Observability for NeMo callouts. This chain cannot see or replace the
# service account token. Praxis adds it after these filters run.
- name: nemo-outbound
filters:
- filter: request_id
insecure_options:
allow_private_endpoints: true # example proxies to local backends
allow_private_upstreams: true # example calls the local NeMo service