Clinical Diagnostic Assistant Deployment Guide#
Solution Blueprints are provided as Helm Charts. The recommended approach to deploy them is to pipe the output of helm template to kubectl apply -f -.
We don’t recommend helm install, which by default uses a Secret to keep track of the related resources.
This does not work well with Enterprise clusters that often have limitations on the kinds of resources that
regular users are allowed to create.
This blueprint is designed to run on AMD Instinct GPUs.
Known issue (Helm 4.2.1+): Helm 4.2.1 and newer leak
Pulled:/Digest:metadata to stdout (helm#32215), which breaks the pipedhelm template … | kubectl apply -f -. Until the fix ships, either use Helm 3.16 – 4.2.0, or pull the chart first:helm pull oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant --untar helm template $name ./aimsb-clinical-diagnostic-assistant --namespace $namespace \ | kubectl apply -f - -n $namespace
Prerequisites#
Requirement |
Needed for |
|---|---|
|
Default deployment |
A node with an AMD Instinct GPU and the AMD GPU device plugin |
Default deployment (not needed with an external LLM) |
HuggingFace token from an account that has accepted the MedGemma license |
Default deployment |
UMLS API key, MedCAT registration details and a Neo4j password |
Knowledge-graph profile (optional) |
Evaluation harness (optional) |
Default Deployment#
The default deployment uses the standard profile: MedGemma, NER, embeddings, the orchestrator and
the UI, without MedCAT or the knowledge graph. It needs only the hf-token Secret.
HuggingFace token#
MedGemma is a gated model. Open https://huggingface.co/google/medgemma-27b-it, accept the
Health AI Developer Foundations Terms of Use,
then create a read token from the same account. Without the accepted license, the MedGemma pod
crash-loops with a 401/403 from HuggingFace. The NER and embedding services also read this
Secret.
name="my-deployment"
namespace="my-namespace"
kubectl create namespace $namespace
kubectl create secret generic hf-token --from-literal=hf-token=<YOUR_HUGGINGFACE_TOKEN> -n $namespace
To use a different Secret name, set both secrets.hfTokenSecret and medgemma.env_vars.HF_TOKEN.name.
Deploy the chart#
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
| kubectl apply -f - -n $namespace
--namespace sets the namespace in the rendered manifests and -n tells kubectl where to apply
them; both are needed. To change other defaults, pass --set flags or -f my-values.yaml, for
example medgemma.resources.limits."amd.com/gpu" or ui.serviceType.
kubectl get pods -n $namespace -w
Resources are named aimsb-cda-$name-<component>, for example aimsb-cda-$name-ui. Keep the
release name to 28 characters or fewer, so every resource name stays within Kubernetes’
63-character limit.
On first run, medgemma-$name downloads the model (~54 GB) and shows 0/1 until it is loaded; its
startup probe allows up to 60 minutes. The model is stored on an ephemeral volume, so a recreated
pod downloads it again. To update a deployment, re-run the same helm template … | kubectl apply
command.
Using an existing deployment or external LLM#
By default, MedGemma is deployed by the Helm chart. If you already have a compatible AIM or another OpenAI-compatible endpoint, you can use that instead and reuse resources.
Set medgemma.enabled=false and set medgemma.existingService to the endpoint’s base URL. For a Kubernetes Service, use http://<SERVICENAME>.<NAMESPACE>.svc.cluster.local:<SERVICEPORT>. The orchestrator requests the model named in pipeline.llmModel (default google/medgemma-27b-it).
service_url="http://aim-llm-my-model-123456.my-namespace.svc.cluster.local:80"
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set medgemma.enabled=false \
--set medgemma.existingService=$service_url \
| kubectl apply -f - -n $namespace
API Key Configuration for External LLM#
When the external LLM requires authentication, set medgemma.apiKey. The orchestrator sends it as an Authorization: Bearer <token> header.
api_url="https://llm-api.example.com"
api_key="<YOUR_API_KEY>"
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set medgemma.enabled=false \
--set medgemma.existingService=$api_url \
--set medgemma.apiKey=$api_key \
--set pipeline.llmModel=<MODEL_NAME> \
| kubectl apply -f - -n $namespace
Using Kubernetes Secrets for API Key#
For enhanced security, store the API key in a Kubernetes Secret and reference it:
kubectl create secret generic my-llm-api-key -n $namespace --from-literal=api-key="<YOUR_API_KEY>"
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set medgemma.enabled=false \
--set medgemma.existingService=$api_url \
--set medgemma.apiKeySecretRef.name=my-llm-api-key \
--set medgemma.apiKeySecretRef.key=api-key \
| kubectl apply -f - -n $namespace
Knowledge-graph profile (optional)#
deploymentProfile: knowledge-graph adds MedCAT, which attaches UMLS/SNOMED codes to entities and
diagnoses, and a Neo4j SNOMED CT knowledge graph built on those codes. The graph adds hints to
candidate generation, a supporting-subgraph panel per diagnosis and a confidence boost for
diagnoses grounded in the graph. Everything else, including the FHIR output format, is the same as
in the standard profile.
It needs a UMLS API key issued by NLM (from https://uts.nlm.nih.gov/uts/edit-profile) and a
one-time registration at https://medcat.sites.er.kcl.ac.uk. The key is used both to download the
MedCAT model and to fetch the SNOMED CT release from NLM; a KCL-only token fails with a 401.
Create the two extra Secrets. The Neo4j password needs at least 8 characters and is applied only when the Neo4j volume is first created:
kubectl create secret generic medcat-credentials -n $namespace \
--from-literal=UMLS_API_KEY=<YOUR_UMLS_API_KEY> \
--from-literal=MEDCAT_FIRST_NAME=<FIRST_NAME> \
--from-literal=MEDCAT_LAST_NAME=<LAST_NAME> \
--from-literal=MEDCAT_EMAIL=<EMAIL> \
--from-literal=MEDCAT_AFFILIATION=<INSTITUTION> \
--from-literal=MEDCAT_USE_CASE=<USE_CASE>
kubectl create secret generic neo4j-auth -n $namespace --from-literal=password=<YOUR_PASSWORD>
Then deploy with the profile enabled:
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set deploymentProfile=knowledge-graph \
| kubectl apply -f - -n $namespace
The MedCAT pod downloads its model (~2–5 GB, medcat.model, default snomed_mimic) and the
one-shot kg-populate Job loads the graph. Both are kept on PVCs and reused on redeploys. Graph
size is controlled by kgPopulate.minTrainingCount and kgPopulate.maxConcepts.
Switching back to the standard profile does not remove the MedCAT and Neo4j resources, because
kubectl apply only acts on what is in the current render. Delete them explicitly:
kubectl delete deployment,service aimsb-cda-$name-medcat aimsb-cda-$name-neo4j -n $namespace
kubectl delete configmap/aimsb-cda-$name-medcat-init job/aimsb-cda-$name-kg-populate -n $namespace --ignore-not-found
Keep the aimsb-cda-$name-model-artifacts, aimsb-cda-$name-neo4j-data and
aimsb-cda-$name-snomed-release PVCs to reuse the model and graph if you switch back.
Evaluation harness (optional)#
evaluator.enabled: true deploys a self-hosted Langfuse and an evaluator that scores the pipeline
against a labeled benchmark. It works with either profile. Langfuse needs an S3-compatible object
store, which the chart does not bundle; create the bucket before deploying.
kubectl create secret generic langfuse-secret -n $namespace \
--from-literal=LANGFUSE_PUBLIC_KEY=pk-lf-<random> \
--from-literal=LANGFUSE_SECRET_KEY=sk-lf-<random> \
--from-literal=LANGFUSE_INIT_USER_PASSWORD=<random> \
--from-literal=SALT=<random> \
--from-literal=ENCRYPTION_KEY=<64-hex-chars> \
--from-literal=NEXTAUTH_SECRET=<random> \
--from-literal=POSTGRES_PASSWORD=<random> \
--from-literal=CLICKHOUSE_PASSWORD=<random> \
--from-literal=REDIS_PASSWORD=<random> \
--from-literal=LANGFUSE_WEBHOOK_SECRET=<random> \
--from-literal=S3_ACCESS_KEY=<your-s3-access-key> \
--from-literal=S3_SECRET_KEY=<your-s3-secret-key>
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set evaluator.enabled=true \
--set langfuse.s3.endpoint=http://<s3-service>.<s3-namespace>.svc:9000 \
| kubectl apply -f - -n $namespace
Generate random values with openssl rand -hex 32 (which also gives the 64 hex characters
ENCRYPTION_KEY needs). The S3 keys can live in a separate Secret instead (langfuse.s3.secretName); set
langfuse.s3.bucket, region and forcePathStyle for your store.
For the webhook setup and running an evaluation, see
Langfuse evaluation harness.
Storage#
PVC |
Size |
Created when |
|---|---|---|
|
20 Gi each |
Always ( |
|
20 Gi |
Knowledge-graph profile |
|
20 Gi, 10 Gi |
Knowledge-graph profile |
|
10 Gi, 20 Gi |
Evaluation harness |
MedGemma also uses an 80 Gi ephemeral volume on the mlstorage StorageClass
(medgemma.storage.ephemeral); set its storageClassName if your cluster has no such class. PVCs
are ReadWriteOnce by default, which works on multi-node clusters. Running NER or embedding with
more than one replica across nodes needs a ReadWriteMany StorageClass
(storage.hfCache.accessModes).
Troubleshooting#
Symptom |
Check |
Common cause |
|---|---|---|
MedGemma |
|
MedGemma license not accepted for the token’s account |
MedCAT stuck in |
|
Invalid UMLS API key or missing |
|
|
|
Langfuse pods unhealthy |
|
Missing key in |
UI shows |
|
Orchestrator not ready yet |
Redeploy fails with |
— |
Delete the Job ( |
To check the pipeline end to end, port-forward the orchestrator and call its health and analysis endpoints:
kubectl port-forward svc/aimsb-cda-$name-orchestrator 8003:8003 -n $namespace &
curl -s http://localhost:8003/sys/health
curl -s -X POST 'http://localhost:8003/Composition/$analyze-note' -H "Content-Type: application/json" \
-d '{"resourceType": "Parameters", "parameter": [{"name": "note", "valueString": "Fever, productive cough and shortness of breath. SpO2 94%."}]}'
Connecting#
Option 1: Port Forwarding#
To connect to the UI, port-forward port 8080. The UI will then be available at http://localhost:8080.
kubectl port-forward services/aimsb-cda-$name-ui 8080:8080 -n $namespace
Option 2: HTTPRoute (Gateway Access)#
If your cluster has a Gateway API compatible gateway (e.g., Kubernetes Gateway, Istio, etc.), you can enable HTTPRoute creation to route traffic through the gateway.
Prerequisites:
A Gateway named
httpsmust exist in theenvoy-gateway-systemnamespace (or sethttp_route.gateway.nameandhttp_route.gateway.namespace).The Gateway must be properly configured with listeners.
Enabling HTTPRoute:
Use --set http_route.enabled=true in the helm template command to enable HTTPRoute creation:
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
--set http_route.enabled=true \
| kubectl apply -f - -n $namespace
Obtaining the URL:
The URL is formed by the UI service name and the hostname of the gateway. Use this command to produce it, or set http_route.hostname to claim a fixed hostname instead:
echo "https://aimsb-cda-$name-ui$(kubectl get gtw -A -o jsonpath='{.items[*].spec.listeners[?(@.name=="https")].hostname}' | tr -d \* | awk '{print $1}')/"
Option 3: LoadBalancer Service#
On clusters with a LoadBalancer implementation (e.g. k3s ServiceLB or MetalLB), set --set ui.serviceType=LoadBalancer, then open http://<EXTERNAL-IP>:8080 using the address from kubectl get svc aimsb-cda-$name-ui -n $namespace.
Clean Up#
When you are finished, remove the deployed resources. Pass the same --set flags you deployed with:
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-clinical-diagnostic-assistant \
--namespace $namespace \
| kubectl delete -f - -n $namespace
This also deletes the PVCs, so models are downloaded again (and the knowledge graph rebuilt) on the next deploy. To keep them, delete only the workloads:
kubectl delete configmap,deployment,httproute,job,service -n $namespace -l app.kubernetes.io/instance=$name
kubectl delete deployment/medgemma-$name service/medgemma-$name -n $namespace