KKIMS on-site docs
Deploy KIMS (UAT and production)

First deploy

Run the environment's kims-platform job (or helm upgrade --install by hand), watch the migrate hook create the database tables, check every pod, CronJob and the readiness endpoint, then point the CMS host's DNS at the ingress.

The first run of the environment's kims-platform Jenkins job builds the image, pushes it, and installs the Helm chart. The chart's kims-migrate Job runs first and creates every database table; then the CMS, the worker and the CronJobs start. After this page the CMS answers, but has no content and nobody can sign in yet.

#Before you start

  • Code pushed: main (and uat for UAT) in KIMS's Git (deploy/push-code).
  • AWS pieces ready: RDS reachable from the nodes on 5432, the assets bucket, the pods' IAM role, the registry, the CMS certificate (aws/access onward).
  • The four Secrets exist in the namespace (deploy/secrets).
  • The values file is in the folder as kims-helm-values (deploy/helm-values).
  • The Jenkins folder, agent, credentials and kims-platform job exist (jenkins/platform-job).
  • Jenkins can deploy to the namespace (a kims-kubeconfig credential, or the agent's role in EKS access entries) (aws/eks).

#Deploy with Jenkins (the normal way)

#Step 1: run kims-platform

  1. Jenkins > kims-production (UAT: kims-uat) > kims-platform.
  2. Build with Parameters. Check REGISTRY (<ACCOUNT_ID>.dkr.ecr.<AWS_REGION>.amazonaws.com), leave NAMESPACE empty (it becomes kims or kims-uat from the branch), DEPLOY ticked.
  3. Build.
Stage What it does Typical time
Checkout The folder's branch. Decides the environment: main is production, uat is UAT Seconds
Install npm ci 2 to 5 minutes
Verify npm run verify: lint, typecheck, unit tests 3 to 8 minutes
Image Builds the image for PLATFORMS and pushes it, tagged with the commit SHA. Skipped (reused) if the registry already has that tag 5 to 15 minutes
Deploy Checks the values file's KIMS_ENVIRONMENT, then helm upgrade --install ... --wait --timeout 10m, then waits for the CMS rollout 2 to 5 minutes

Expected: the build is green, its name reads like #1 production 535cdc7a1b2c, and the log ends Deployed <REGISTRY>/kims/kims-v2:<SHA> to production (namespace kims).

#Deploy by hand (if KIMS prefers, or to debug)

#Step 1 (by hand): helm upgrade --install

Only with the image already pushed for that commit, from a kims-v2 checkout on the same commit, with Helm 3.14 or later (not Helm 4) and access to the namespace:

bash
SHA=$(git rev-parse HEAD)
helm upgrade --install kims deploy/helm/kims \
  --kube-context <KUBE_CONTEXT> --namespace <NAMESPACE> \
  --values ~/kims-config/values-production.yaml \
  --set image.repository=<REGISTRY>/kims/kims-v2 \
  --set image.tag="$SHA" \
  --wait --timeout 10m
bash
SHA=$(git rev-parse HEAD)
helm upgrade --install kims deploy/helm/kims \
  --kube-context <KUBE_CONTEXT> --namespace <NAMESPACE> \
  --values ~/kims-config/values-production.yaml \
  --set image.repository=<REGISTRY>/kims/kims-v2 \
  --set image.tag="$SHA" \
  --wait --timeout 10m
powershell
$Sha = git rev-parse HEAD
helm upgrade --install kims deploy/helm/kims --kube-context <KUBE_CONTEXT> --namespace <NAMESPACE> --values "$HOME\kims-config\values-production.yaml" --set image.repository=<REGISTRY>/kims/kims-v2 --set image.tag=$Sha --wait --timeout 10m

Expected: Release "kims" does not exist. Installing it now., then STATUS: deployed, REVISION: 1, and the chart's notes:

text
KIMS <SHA> is installed as "kims" in kims.

  CMS          deployment/kims-cms (2 replicas)
  CMS address  https://<CMS_HOST>
  Worker       deployment/kims-worker
  Scheduled    5 CronJobs (kubectl get cronjobs -l app.kubernetes.io/instance=kims)
  Migrations   kubectl -n kims logs job/kims-migrate

Use the UAT values file and -n kims-uat for UAT. By hand there is no branch guard: check you have the right values file for the namespace.

#The migrate hook

#What it does

Before anything else is installed (and before every later upgrade), Helm runs the Job kims-migrate with the image in MODE=migrate. It connects with the kims-database Secret and applies every pending SQL migration in db/migrations (eight today), creating the tables and the citext extension. If it fails, the deploy stops; on later deploys the running version stays up.

#Step 2: read its log

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs job/kims-migrate
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs job/kims-migrate
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs job/kims-migrate

Expected on the first deploy, ending:

text
[migrate] done: 8 applied, 0 already in place

On later deploys with no new migrations: [migrate] done: 0 applied, 8 already in place.

#Check the deploy

#Step 3: pods, Jobs and CronJobs

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get pods,jobs,cronjobs
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get pods,jobs,cronjobs
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get pods,jobs,cronjobs

Expected (names end in random suffixes; CronJob runs appear and vanish):

text
NAME                               READY   STATUS      RESTARTS   AGE
pod/kims-cms-6d9f7c8b5d-4xk2p      1/1     Running     0          3m
pod/kims-cms-6d9f7c8b5d-q8w7z      1/1     Running     0          3m
pod/kims-migrate-abcde             0/1     Completed   0          4m
pod/kims-worker-7b5c9d6f4-m2n3b    1/1     Running     0          3m

NAME                     STATUS     COMPLETIONS   DURATION   AGE
job.batch/kims-migrate   Complete   1/1           20s        4m

NAME                                             SCHEDULE       TIMEZONE       SUSPEND   ACTIVE   LAST SCHEDULE
cronjob.batch/kims-cron-alerts                   */15 * * * *   Asia/Kolkata   False     0        2m
cronjob.batch/kims-cron-reviews-sync             0 */6 * * *    Asia/Kolkata   False     0        <none>
cronjob.batch/kims-cron-scheduled-publish-tick   * * * * *      Asia/Kolkata   False     0        30s
cronjob.batch/kims-cron-site-build-reap          */10 * * * *   Asia/Kolkata   False     0        1m
cronjob.batch/kims-cron-translation-tick         */5 * * * *    Asia/Kolkata   False     0        1m

kims-cms shows two pods in production (one or two in UAT), each 1/1 Running.

#Step 4: the readiness endpoint

The readiness check runs SELECT 1 on the database. Forward a local port to the CMS Service, and leave it running:

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> port-forward svc/kims-cms 3000:80
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> port-forward svc/kims-cms 3000:80
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> port-forward svc/kims-cms 3000:80

Expected: Forwarding from 127.0.0.1:3000 -> 3000. In a second window:

bash
curl -s "http://localhost:3000/api/health?check=ready"; echo
bash
curl -s "http://localhost:3000/api/health?check=ready"; echo
powershell
curl.exe -s "http://localhost:3000/api/health?check=ready"

Expected: {"status":"ready","database":"ok"}. {"status":"not-ready","database":"unreachable"} (HTTP 503) means the CMS cannot reach RDS. Stop the port-forward with Ctrl+C.

In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest; always type curl.exe.

#Step 5: the service account carries the IAM role

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get serviceaccount kims -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}'; echo
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec deploy/kims-worker -- printenv AWS_ROLE_ARN
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get serviceaccount kims -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}'; echo
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec deploy/kims-worker -- printenv AWS_ROLE_ARN
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get serviceaccount kims -o jsonpath="{.metadata.annotations.eks\.amazonaws\.com/role-arn}"
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> exec deploy/kims-worker -- printenv AWS_ROLE_ARN

Expected: the role ARN from the values file, twice. If the second command prints nothing, the EKS pod identity webhook did not inject the role: the cluster's OIDC provider is missing (aws/eks).

#Give the CMS its host name

#Step 6: find the load balancer's address

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get ingress kims-cms
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get ingress kims-cms
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> get ingress kims-cms

Expected (with the AWS Load Balancer Controller), within a few minutes:

text
NAME       CLASS   HOSTS            ADDRESS                                                       PORTS   AGE
kims-cms   alb     <CMS_HOST>       k8s-kims-kimscms-0123456789-1234567890.ap-south-2.elb.amazonaws.com   80      5m

#Step 7: DNS record for the CMS

KIMS's DNS team adds a CNAME from <CMS_HOST> to the ADDRESS above (or a Route 53 alias A record to the load balancer). Then check:

bash
nslookup <CMS_HOST>
curl -sI https://<CMS_HOST>/api/health | head -1
bash
nslookup <CMS_HOST>
curl -sI https://<CMS_HOST>/api/health | head -1
powershell
Resolve-DnsName <CMS_HOST>
curl.exe -sI https://<CMS_HOST>/api/health

Expected: the name resolves to the load balancer, and HTTP/2 200 (or HTTP/1.1 200 OK) with a valid certificate. A certificate error means the ACM certificate does not cover <CMS_HOST>, or certificate-arn is wrong.

Keycloak's redirect URIs and the Google OAuth redirect URI use this host, so it must work before anyone signs in.

#Quick way: the deploy helper's check

bash
node deployment-steps/scripts/deploy.mjs kims check --context <KUBE_CONTEXT> --namespace <NAMESPACE>

Expected: ends OK: the deploy in <NAMESPACE> is healthy. It checks pods, kims-migrate, the CronJobs and the readiness endpoint through a port-forward it stops afterwards. Read-only.

#UAT and production

UAT Production
Job kims-uat/kims-platform from uat kims-production/kims-platform from main
Namespace kims-uat kims
Image Built on the first run Reused if UAT already built that commit (... is already in the registry; deploying it as it is.)
Database Migrated by its own kims-migrate Same, on the production database
Trigger after go-live Every push to uat (webhook or polling) By hand, on a commit UAT has accepted (agree with KIMS)

#If it goes wrong

What you see Cause Fix
Branch '...' deploys nowhere The job is not on main or uat Fix the job's branch (jenkins/platform-job)
The Helm values file says KIMS_ENVIRONMENT ... The other environment's values in this folder Upload the right kims-helm-values
Error: ... forbidden: User ... cannot ... at Deploy Jenkins has no deploy rights in the namespace kims-kubeconfig, or the agent's EKS access entry (aws/eks)
kims-migrate fails, timing out on the database 5432 not open from the nodes to RDS RDS security group (aws/rds-postgresql)
kims-migrate: permission denied to create extension "citext" The database user cannot create extensions KIMS runs CREATE EXTENSION citext; in kims as the master user, then rerun the job
kims-migrate: self-signed certificate in certificate chain The Node driver verifies RDS's certificate Use ?sslmode=require&uselibpqcompat=true: aws/rds-postgresql
kims-migrate: no pg_hba.conf entry ... no encryption or SSL errors sslmode=require missing Fix kims-database (deploy/secrets)
Pods CreateContainerConfigError A Secret or key missing kubectl -n <NAMESPACE> describe pod <POD> names it
Pods ImagePullBackOff Nodes cannot pull, or the tag does not exist describe pod shows the pull error; node role or image.pullSecrets (aws/ecr)
CMS CrashLoopBackOff, log says SESSION_SECRET or KEYCLOAK_* is not set A Secret value empty, or an env key missing Fix the Secret or values
Pods Pending, exceeded quota or Insufficient cpu ResourceQuota or cluster capacity KIMS raises the quota or adds nodes
Helm timed out waiting for the condition Any of the above kubectl -n <NAMESPACE> get pods, describe pod, logs deploy/kims-cms
Ingress has no ADDRESS No controller for the class, or subnet tags missing kubectl -n <NAMESPACE> describe ingress kims-cms shows the controller's events

To read logs:

bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-cms --tail=100
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-worker --tail=100
bash
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-cms --tail=100
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-worker --tail=100
powershell
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-cms --tail=100
kubectl --context <KUBE_CONTEXT> -n <NAMESPACE> logs deploy/kims-worker --tail=100

#Sources

Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.