The database and the assets bucket are only reachable from inside KIMS's network, so the bundle is copied into a one-off pod in the namespace and loaded from there. The pod runs as the chart's kims service account (so it has the IAM role that writes the assets bucket) and reads the same kims-database Secret as the CMS.
#What the bundle holds
#Contents
| Part | Count |
|---|---|
publish_versions |
1 (the content arrives as published version 1) |
published_files |
2,750 (entities, the 489 blogs among them) |
state_objects |
8,274 (drafts, workflow, indexes) |
media_assets |
1,102 |
media_usage |
1,120 |
| Total rows | 13,247 |
| Files for the assets bucket | 11,307, about 530 MB |
#What it does not bring
People (they come from Keycloak and the People screen), sessions, jobs, site build history, the old platform's audit trail, and stored Google secrets (they were encrypted with the old SECRETS_KEY).
#How the load behaves
- Checks every file against the bundle's SHA-256 checksums.
- Refuses a database that lacks a migration the bundle was made with.
- Refuses a database whose content tables already have rows.
- Uploads the files to the assets bucket, skipping any already there at the same size.
- Writes all the rows in one transaction.
If it stops part way, nothing is half-written in the database: run it again. Files already uploaded are skipped.
#Before you start
- deploy/first-deploy is done: the
kims-migrateJob completed and the deploy check passes. - Nobody has used the CMS yet: the load only goes into an empty database.
- The bundle on your machine passes its check (below).
- You know the image the deploy runs, the assets bucket and the region.
- The namespace does not enforce Pod Security
restricted(the load pod does not meet it;baselineis fine).
#Check the bundle copy
From the kims-v2 folder, with npm install done:
node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>node scripts/handover/data-bundle.mjs check --from <PATH_TO_DATA_BUNDLE>Expected: bundle ok: 13247 rows, 11307 objects, made 2026-11-24T14:03:17.744Z. Anything else (missing, checksum differs) means the copy is damaged: copy it again.
#Quick way: the deploy helper
It checks the bundle, checks the first deploy is done, fills in the pod file, starts the pod, copies the bundle, loads it and always deletes the pod. Pass --region: the helper defaults to ap-south-1, which is wrong if the buckets are in Hyderabad.
node deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --contentnode deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --contentnode deployment-steps/scripts/deploy.mjs kims content load --context <KUBE_CONTEXT> --namespace <NAMESPACE> --image <IMAGE> --bucket <ASSETS_BUCKET> --region <AWS_REGION> --bundle <PATH_TO_DATA_BUNDLE>
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --contentExpected: the first ends OK: the content and media are loaded.; the second compares the row counts with the bundle and ends OK: the deploy in <NAMESPACE> is healthy.
#By hand
#Step 1: find the image the deploy runs
IMAGE=$(kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "$IMAGE"IMAGE=$(kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "$IMAGE"$Image = kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get deployment kims-cms -o jsonpath="{.spec.template.spec.containers[0].image}"
$ImageExpected: <REGISTRY>/kims/kims-v2:<40-character SHA>. Use exactly this, never latest.
#Step 2: fill in the pod file
deploy/handover/load-bundle-pod.yaml has three values to replace: the image, the assets bucket, and the region (ap-south-2 in the file; change it if the bucket is in ap-south-1). The pod sleeps for two hours waiting to be used.
sed -e "s#<registry>/kims/kims-v2:<tag>#${IMAGE}#" \
-e "s#<assets-bucket>#<ASSETS_BUCKET>#" \
-e "s#value: ap-south-2#value: <AWS_REGION>#" \
deploy/handover/load-bundle-pod.yaml > ~/kims-config/load-bundle-pod.yaml
grep -n "image:\|value:" ~/kims-config/load-bundle-pod.yamlsed -e "s#<registry>/kims/kims-v2:<tag>#${IMAGE}#" \
-e "s#<assets-bucket>#<ASSETS_BUCKET>#" \
-e "s#value: ap-south-2#value: <AWS_REGION>#" \
deploy/handover/load-bundle-pod.yaml > ~/kims-config/load-bundle-pod.yaml
grep -n "image:\|value:" ~/kims-config/load-bundle-pod.yaml(Get-Content deploy\handover\load-bundle-pod.yaml -Raw) `
-replace '<registry>/kims/kims-v2:<tag>', $Image `
-replace '<assets-bucket>', '<ASSETS_BUCKET>' `
-replace 'value: ap-south-2', 'value: <AWS_REGION>' |
Set-Content -Encoding ascii "$HOME\kims-config\load-bundle-pod.yaml"
Select-String -Path "$HOME\kims-config\load-bundle-pod.yaml" -Pattern 'image:|value:'Expected: the image: line shows the full image, and the two value: lines show the bucket and region. No < left.
#Step 3: start the pod
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f ~/kims-config/load-bundle-pod.yaml
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300skubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f ~/kims-config/load-bundle-pod.yaml
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300skubectl --context <KUBE_CONTEXT> -n <NAMESPACE> apply -f "$HOME\kims-config\load-bundle-pod.yaml"
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> wait --for=condition=Ready pod/kims-load-bundle --timeout=300sExpected: pod/kims-load-bundle created, then pod/kims-load-bundle condition met. If apply says violates PodSecurity "restricted:latest", the namespace enforces restricted: ask KIMS to set it to baseline with restricted as a warning.
#Step 4: copy the bundle in
About 530 MB: a few minutes over a VPN (105 seconds on a local cluster). kubectl cp needs tar in the pod; the image has it.
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp <PATH_TO_DATA_BUNDLE> kims-load-bundle:/bundle/data-bundlekubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp <PATH_TO_DATA_BUNDLE> kims-load-bundle:/bundle/data-bundle# From the folder that CONTAINS data-bundle, using the bare name:
Set-Location <FOLDER_HOLDING_DATA_BUNDLE>
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> cp data-bundle kims-load-bundle:/bundle/data-bundleExpected: no output when it works. On Windows, a full path such as C:\... fails with error: one of src or dest must be a local file specification, because kubectl cp reads C: as a pod name: always cd first and use the bare name.
#Step 5: load it
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundlekubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundlekubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec kims-load-bundle -- kims-entrypoint data-bundle load --from /bundle/data-bundleExpected, in under ten minutes with an empty bucket:
bundle ok: 13247 rows, 11307 objects, made 2026-11-24T14:03:17.744Z
uploading 11307 objects to <ASSETS_BUCKET>
500 of 11307
...
objects: 11307 uploaded, 0 already there
publish_versions: 1 rows
published_files: 2750 rows
state_objects: 8274 rows
media_assets: 1102 rows
media_usage: 1120 rows
load finished#Step 6: delete the pod, always
Even if the load failed:
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundlekubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundlekubectl --context <KUBE_CONTEXT> -n <NAMESPACE> delete pod kims-load-bundleExpected: pod "kims-load-bundle" deleted.
#Check
| Check | How | Expected |
|---|---|---|
| Rows match the bundle | node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE> --content |
publish_versions 1, published_files 2,750, state_objects 8,274, media_assets 1,102, media_usage 1,120 |
| Files are in the bucket | aws s3 ls s3://<ASSETS_BUCKET>/ --recursive --summarize --region <AWS_REGION> (last two lines) |
Total Objects: 11307, Total Size: about 530 MB |
| The pod is gone | kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get pod kims-load-bundle |
Error from server (NotFound) |
| Content in the CMS | After deploy/people: the dashboard and Media library | 183 doctors, 72 specialties, 320 conditions, 1,331 treatments; images show |
On Windows, the aws s3 ls line is the same in PowerShell; add | Select-Object -Last 2.
#Next: the Emergency image
One image never reached the old platform's storage: emergency_CoE.png, the hero of en/centres-of-excellence/emergency-critical-care. Until it is replaced, every publish is refused. It is fixed in the CMS once an Admin can sign in: deploy/website.
#Reloading
#When a load was wrong
The load never merges into existing content. To load again:
- Make sure nobody has made changes worth keeping.
- Either have KIMS recreate the database (drop and create
kims, owned by the same user) and rerunkims-platformsokims-migratecreates the tables again, or empty the five content tables (publish_versions,published_files,state_objects,media_assets,media_usage) as the database owner. - Run Step 3 onward again. Files already in the bucket are skipped.
Recreating the database also removes people, jobs and build history, which is usually what you want before go-live. It also removes the Google secrets: enter them again (google/translation-api-key, google/reviews-oauth).
#UAT and production
| UAT | Production | |
|---|---|---|
| Namespace | kims-uat |
kims |
| Image | UAT's kims-cms image |
Production's kims-cms image |
| Bucket | UAT assets bucket | Production assets bucket |
| Bundle | The handover bundle | The handover bundle again, or an export of UAT's reviewed content (agree with KIMS) |
To export UAT's content (not yet rehearsed on KIMS): run node scripts/handover/data-bundle.mjs export --out <DIR> (or kims-entrypoint data-bundle export --out <DIR> in a pod built like the load pod) with UAT's DATABASE_URL, ASSETS_BUCKET and S3_REGION, from somewhere that reaches UAT's database and bucket, then check and load it into production. Either way the production database must be empty, and the Emergency image fixed before production's first publish.
#If it goes wrong
| What you see | Cause | Fix |
|---|---|---|
<table> already has N rows; load only goes into an empty database |
Loaded before, or someone used the CMS | If the earlier load was right, nothing to do. Otherwise Reloading |
The database is missing migrations the bundle was made with: ... Run the migrate job first. |
kims-migrate did not run or failed |
deploy/first-deploy |
The bundle does not match its manifest (N problems) |
Damaged copy | Copy the bundle again, check, retry |
AccessDenied uploading |
The pods' role cannot write the assets bucket, or its trust does not name this namespace's kims service account |
aws/iam |
Upload errors naming a redirect or PermanentRedirect |
Wrong region in the pod | Fix S3_REGION in the pod file (or --region), start again |
Pod Pending or ImagePullBackOff |
Wrong image tag, or quota | Use the exact image from step 1; kubectl describe pod kims-load-bundle |
error: one of src or dest must be a local file specification |
A Windows path with a drive letter | Step 4 |
#Sources
kims-v2/scripts/handover/data-bundle.mjs(main)kims-v2/deploy/handover/load-bundle-pod.yaml(main)kims-v2/deploy/entrypoint.shkims-v2/docs/ON-SITE-DEPLOYMENT.md(main, step 5 and step 10)kims-deploy-info/kims/08-content-load.mdkims-deploy-info/scripts/README.md- https://kubernetes.io/docs/reference/kubectl/generated/kubectl_cp/
- https://kubernetes.io/docs/concepts/security/pod-security-admission/