The last step of the visit. Do it with KIMS's infrastructure team and the person who will run the CMS (the first Admin).
#Things to tell KIMS
#Revocation timing
Signing someone out in Keycloak ends their CMS session at once. Disabling an account, or removing cms-access, ends it at the CMS's next check with Keycloak, within 5 minutes. Details: keycloak/revocation.
#Two jobs per environment
Their Jenkins gains a kims-production folder (and kims-uat if they have UAT), each with kims-platform and kims-site-build. Nothing else in their Jenkins changes. The CMS worker starts kims-site-build after every publish, as the Jenkins user whose token is in kims-jenkins.
#UAT can come later
If KIMS started with production only, adding UAT later is: a uat branch made from main (deploy/push-code), a second set of AWS resources, a kims-uat folder, and deploy/secrets to deploy/acceptance again with UAT's files. Nothing in production changes.
#How code changes reach production
- With UAT: change
uat,kims-uat/kims-platformdeploys it, KIMS accepts it, thengit push kims uat:main(fast-forward only) andkims-production/kims-platformdeploys the same image. - Production only: change
main, andkims-production/kims-platformdeploys it. - Content is never promoted between environments; it is edited and published in production's CMS.
#Rollback
- Code: rerun
kims-platformon an earlier commit (a revert commit), orhelm rollback kims <REVISION> -n kims(UAT:-n kims-uat). - Content: restore a page's earlier version from its version history in the CMS, then publish.
- Database: RDS point-in-time recovery, the last resort.
Full steps: deploy/production-cutover.
#What reaches AWS
S3 and CloudFront only, through IAM roles: the pods' role (assets bucket) and the Jenkins agent's role (assets read, website write, CloudFront invalidation, the redirects store if used). No Lambda, no access keys.
#The secrets key must never change
secrets-key in the kims-app Secret encrypts what Admins save in the CMS (the Translation API key, the Google reviews client and connection). If it is lost or changed, those must be entered again. Keep the copy in KIMS's vault. Details: deploy/secrets.
#Alerts
The alerts scheduled task writes a log line with "level":"alert" once per problem: a publish that no site build picked up (publish-without-build), or a latest site build that failed (build-failed). KIMS should send those lines to whoever looks after the site: their log platform can search the pods' logs for "level":"alert". To look by hand:
kubectl -n kims logs -l kims.org/cron-task=alerts --tail=-1 | grep '"level":"alert"'kubectl -n kims logs -l kims.org/cron-task=alerts --tail=-1 | grep '"level":"alert"'kubectl -n kims logs -l kims.org/cron-task=alerts --tail=-1 | Select-String '"level":"alert"'Expected on a healthy site: no output.
#People
Everyone who works in the CMS needs cms-access on the environment's Keycloak client and a row on the CMS People screen. Keep at least two Admins. A person cannot approve their own change. Details: deploy/people.
#Google services
Admins manage them in the CMS: the Translation screen (API key) and the Google reviews screen (connection). The reviews OAuth client is saved by a script, not a CMS screen (google/reviews-oauth). Reviews reach the website only at the next site build.
#What to leave written down
Fill this in with KIMS and give it to their infrastructure team. Names, addresses and identifiers only. Never a secret value: secrets stay in Kubernetes Secrets, Jenkins credentials and KIMS's vault.
| Item | Production | UAT |
|---|---|---|
| Website host | ||
| CMS host | ||
| CloudFront distribution ID and domain | ||
| Website bucket, assets bucket, region | ||
| RDS instance identifier and endpoint | ||
| EKS cluster and namespace | ||
| ECR repository | ||
| IAM role for the pods (ARN) | ||
| IAM role for the Jenkins agent (ARN) | ||
| Jenkins folder and jobs | ||
| Jenkins user the worker uses | ||
| Keycloak realm and client ID | ||
| Helm release name and current revision | ||
| Commit deployed (12 characters) | ||
| Live published version | ||
| Google Cloud project ID | ||
| Translation API key name (not the key) | ||
| Reviews OAuth client name (not the secret) | ||
| GTM container ID, if any | ||
| Redirects KeyValueStore ARN, if any | ||
| Where the vault copies of the Secrets are | ||
| Who decides go-live and rollbacks | ||
| Open questions and known issues |
#Find the values to fill in
helm -n <NAMESPACE> list
kubectl -n <NAMESPACE> get deploy kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}'; echo
kubectl -n <NAMESPACE> get sa -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.annotations.eks\.amazonaws\.com/role-arn}{"\n"}{end}'
kubectl -n <NAMESPACE> get ingresshelm -n <NAMESPACE> list
kubectl -n <NAMESPACE> get deploy kims-cms -o jsonpath='{.spec.template.spec.containers[0].image}'; echo
kubectl -n <NAMESPACE> get sa -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.annotations.eks\.amazonaws\.com/role-arn}{"\n"}{end}'
kubectl -n <NAMESPACE> get ingresshelm -n <NAMESPACE> list
kubectl -n <NAMESPACE> get deploy kims-cms -o jsonpath="{.spec.template.spec.containers[0].image}"
kubectl -n <NAMESPACE> get sa -o jsonpath="{range .items[*]}{.metadata.name}{' '}{.metadata.annotations.eks\.amazonaws\.com/role-arn}{'\n'}{end}"
kubectl -n <NAMESPACE> get ingressExpected: the release kims with its REVISION and STATUS deployed; the image ending :<COMMIT_SHA>; the kims service account with its role ARN; the ingress with the CMS host and the load balancer address.
#Remove the engineer's access
Do this last, with KIMS watching, once nothing else needs you. Before each removal make sure someone at KIMS has the same access, so nothing is left without an owner.
#Files on your computer
Delete anything copied for the visit: values files, kims-site-env files, the data bundle, kubeconfig contexts.
kubectl config get-contexts
kubectl config delete-context <CONTEXT_NAME>
rm -f <VALUES_FILE> <SITE_ENV_FILE>kubectl config get-contexts
kubectl config delete-context <CONTEXT_NAME>
rm -f <VALUES_FILE> <SITE_ENV_FILE>kubectl config get-contexts
kubectl config delete-context <CONTEXT_NAME>
Remove-Item <VALUES_FILE>, <SITE_ENV_FILE>Expected: deleted context <CONTEXT_NAME> from ..., and the context gone from get-contexts. The temporary folders the deploy/secrets steps made should already be gone; check.
#AWS
KIMS's AWS admin removes (or ends the session of) the IAM user, role or Identity Center assignment you used, and any EKS access entry made for you:
- IAM > Users (or IAM Identity Center > AWS accounts > the account > your assignment) > remove.
- EKS > the cluster > Access > IAM access entries > your entry > Delete.
Check from your machine:
aws sts get-caller-identity
kubectl -n <NAMESPACE> get podsaws sts get-caller-identity
kubectl -n <NAMESPACE> get podsaws sts get-caller-identity
kubectl -n <NAMESPACE> get podsExpected: an error (ExpiredToken, InvalidClientTokenId or AccessDenied) and error: You must be logged in to the server (Unauthorized) or similar.
#Jenkins
- Manage Jenkins > Users > your account > Delete, or ask KIMS to remove your rights.
- If you made an API token for yourself, revoke it: your user > Security > API Token > the token > Revoke.
Keep the worker's Jenkins user and its token; the CMS needs them.
#Keycloak and the CMS
- Keycloak: Users > your account > Role mapping >
cms-access> Unassign (each environment's client), or ask KIMS to disable the account. - CMS: an Admin removes you from People.
Expected: your next click in the CMS goes to sign-in, then "no access".
#Google Cloud
- IAM & Admin > IAM > your account > Edit principal (pencil) > remove each role > Save.
- Confirm at least one KIMS account is Owner first.
- Billing > Account management: remove yourself from the billing account if you were added.
- Google Business Profile: KIMS removes you as a manager if you were added (support.google.com/business/answer/3415589).
- Google Tag Manager: Admin > User Management > your account > remove.
#Git
Remove your access to KIMS's Git repository (or the deploy key you used), and remove the kims remote from your clone if you keep it:
git remote remove kimsgit remote remove kimsgit remote remove kims#UAT and production
Everything above is done for each environment that exists. The access removal is done once, at the very end.
#Sources
kims-v2/docs/ON-SITE-DEPLOYMENT.md(main, "Things to tell KIMS")kims-v2/apps/cms/src/lib/jobs/handlers.ts(alerts)kims-v2/deploy/helm/kims/templates/cronjobs.yamlkims-v2/packages/secrets(what the secrets key encrypts)- https://docs.aws.amazon.com/eks/latest/userguide/access-entries.html
- https://cloud.google.com/iam/docs/granting-changing-revoking-access
- https://www.jenkins.io/doc/book/security/managing-security/
- https://www.keycloak.org/docs/latest/server_admin/#assigning-role-mappings
- https://support.google.com/tagmanager/answer/6107011