KIMS already runs an EKS cluster. KIMS v2 does not get a cluster of its own: it gets a namespace in KIMS's cluster (kims for production, kims-uat for UAT if KIMS has one), an IAM role for its pods, and an ingress for the CMS.
#Who does what
| Task | Usually done by | What our engineer needs |
|---|---|---|
| The cluster, its node groups, its add-ons | KIMS's platform team (exists) | The cluster name and region |
| The IAM OIDC provider for the cluster | KIMS's platform team (often exists) | Nothing, once it exists |
| The AWS Load Balancer Controller (or another ingress controller) | KIMS's platform team | The ingress class name |
| Access entries: you, and the Jenkins agent's role | KIMS's platform team | kubectl access to the namespace |
The namespace (kims, kims-uat) |
KIMS (needs cluster-wide rights) | Its name |
| The IAM role for the pods (IRSA) | KIMS's cloud team, or our engineer | Its ARN, for serviceAccount.roleArn |
| The Helm values for the ingress | Our engineer | The CMS host, the certificate ARN, internet or VPN only |
| The DNS record for the CMS host | KIMS's DNS team | The load balancer's address, after the first deploy |
#The values to collect
| Value | Example | Goes into |
|---|---|---|
| Cluster name | <EKS_CLUSTER_NAME> |
aws eks update-kubeconfig |
| Region | ap-south-2 |
Every command |
| Namespace | kims (UAT: kims-uat) |
NAMESPACE on the platform job (empty means these defaults) |
| OIDC provider id | <OIDC_ID> (32 hex characters) |
The IRSA trust policy (IAM) |
| Ingress class | alb |
cms.ingress.className |
| CMS host | <CMS_HOST> (for example cms.kimshospitals.com) |
CMS_URL, cms.ingress.host, Keycloak redirect URIs |
| CMS certificate ARN (cluster's region) | arn:aws:acm:ap-south-2:<AWS_ACCOUNT_ID>:certificate/<ID> |
The ALB annotation (Certificates) |
| Node architecture | amd64 or arm64 |
PLATFORMS on the platform job |
#Get kubectl access
You need the AWS CLI signed in to KIMS's account (Access) and kubectl (kubectl and Helm). The --alias gives the context a short name used on every page of this site.
export AWS_REGION=ap-south-2
aws eks update-kubeconfig --name <EKS_CLUSTER_NAME> --region "$AWS_REGION" --alias kims-eks
kubectl config use-context kims-eks
kubectl get namespace kimsexport AWS_REGION=ap-south-2
aws eks update-kubeconfig --name <EKS_CLUSTER_NAME> --region "$AWS_REGION" --alias kims-eks
kubectl config use-context kims-eks
kubectl get namespace kims$env:AWS_REGION = "ap-south-2"
aws eks update-kubeconfig --name <EKS_CLUSTER_NAME> --region $env:AWS_REGION --alias kims-eks
kubectl config use-context kims-eks
kubectl get namespace kimsYou should see Updated context kims-eks in ... (the kubeconfig is ~/.kube/config, or %USERPROFILE%\.kube\config on Windows), then:
NAME STATUS AGE
kims Active 3dThe kubeconfig calls aws eks get-token each time, so kubectl uses whatever AWS profile is active (AWS_PROFILE). When your SSO session ends, kubectl fails too: sign in again with aws sso login.
#Check what you may do
kubectl auth can-i create secrets -n kims
kubectl auth can-i get pods -n kims
kubectl auth can-i create namespaceskubectl auth can-i create secrets -n kims
kubectl auth can-i get pods -n kims
kubectl auth can-i create namespaceskubectl auth can-i create secrets -n kims
kubectl auth can-i get pods -n kims
kubectl auth can-i create namespacesFor the deployment you need yes, yes. The last one is usually no, and that is fine: KIMS creates namespaces.
#Access entries and the aws-auth ConfigMap
EKS decides who may use the cluster in one of two ways. Check which one KIMS's cluster uses:
aws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.accessConfig.authenticationMode --output textaws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.accessConfig.authenticationMode --output textaws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.accessConfig.authenticationMode --output text| Answer | Meaning | What to do |
|---|---|---|
API |
Only access entries (managed in the EKS API) | Use the steps below |
API_AND_CONFIG_MAP |
Access entries and the older aws-auth ConfigMap both work |
Use access entries |
CONFIG_MAP |
Only the aws-auth ConfigMap in kube-system |
Stop and ask KIMS's platform team. A mistake in aws-auth can lock everyone out of the cluster. They add the mapping |
#Give the Jenkins agent's role deploy access
The kims-platform job runs helm upgrade --install and kubectl rollout status in the environment's namespace. One of two ways (deploy/jenkins/README.md on main, section 2, and docs/ON-SITE-DEPLOYMENT.md, AWS set-up G):
- A kubeconfig in Jenkins (the
kims-kubeconfigSecret file credential): see Jenkins credentials. - The agent's IAM role mapped in EKS (no token to look after): leave the job's
KUBECONFIG_CREDENTIALS_IDempty. Steps below.
Console (KIMS's platform team):
- EKS console > Clusters > the cluster > Access tab > IAM access entries > Create access entry.
- IAM principal ARN: the agent's role (
arn:aws:iam::<AWS_ACCOUNT_ID>:role/<AGENT_ROLE_NAME>). Type:Standard. Next. - Add access policy: Policy name
AmazonEKSAdminPolicy, Access scopeKubernetes Namespace, Namespaceskims(addkims-uattoo if one agent deploys both). Add policy, Next, Create.
CLI:
CLUSTER=<EKS_CLUSTER_NAME>
AGENT_ROLE_ARN=arn:aws:iam::<AWS_ACCOUNT_ID>:role/<AGENT_ROLE_NAME>
aws eks create-access-entry --cluster-name "$CLUSTER" --principal-arn "$AGENT_ROLE_ARN"
aws eks associate-access-policy --cluster-name "$CLUSTER" --principal-arn "$AGENT_ROLE_ARN" \
--policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy \
--access-scope type=namespace,namespaces=kims,kims-uatCLUSTER=<EKS_CLUSTER_NAME>
AGENT_ROLE_ARN=arn:aws:iam::<AWS_ACCOUNT_ID>:role/<AGENT_ROLE_NAME>
aws eks create-access-entry --cluster-name "$CLUSTER" --principal-arn "$AGENT_ROLE_ARN"
aws eks associate-access-policy --cluster-name "$CLUSTER" --principal-arn "$AGENT_ROLE_ARN" \
--policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy \
--access-scope type=namespace,namespaces=kims,kims-uat$Cluster = "<EKS_CLUSTER_NAME>"
$AgentRoleArn = "arn:aws:iam::<AWS_ACCOUNT_ID>:role/<AGENT_ROLE_NAME>"
aws eks create-access-entry --cluster-name $Cluster --principal-arn $AgentRoleArn
aws eks associate-access-policy --cluster-name $Cluster --principal-arn $AgentRoleArn `
--policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSAdminPolicy `
--access-scope "type=namespace,namespaces=kims,kims-uat"Leave kims-uat out of namespaces= if KIMS has no UAT. If create-access-entry says ResourceInUseException, the role already has an entry: run only associate-access-policy.
The role also needs eks:DescribeCluster on the cluster, to write its own kubeconfig on the agent (IAM, platform job). Then, on the agent, as the user Jenkins runs as:
aws eks update-kubeconfig --name <EKS_CLUSTER_NAME> --region ap-south-2#Give yourself access the same way
Same steps with your own principal. For an Identity Center user it is the role your session uses, which looks like arn:aws:iam::<AWS_ACCOUNT_ID>:role/aws-reserved/sso.amazonaws.com/<REGION>/AWSReservedSSO_<PERMISSION_SET>_<ID>; give EKS the ARN without the aws-reserved/sso.amazonaws.com/<REGION>/ path: arn:aws:iam::<AWS_ACCOUNT_ID>:role/AWSReservedSSO_<PERMISSION_SET>_<ID>. AmazonEKSEditPolicy scoped to the namespace is enough to create Secrets and read pods and logs.
#Check access entries
aws eks list-access-entries --cluster-name <EKS_CLUSTER_NAME> --output table
aws eks list-associated-access-policies --cluster-name <EKS_CLUSTER_NAME> --principal-arn "$AGENT_ROLE_ARN"aws eks list-access-entries --cluster-name <EKS_CLUSTER_NAME> --output table
aws eks list-associated-access-policies --cluster-name <EKS_CLUSTER_NAME> --principal-arn "$AGENT_ROLE_ARN"aws eks list-access-entries --cluster-name <EKS_CLUSTER_NAME> --output table
aws eks list-associated-access-policies --cluster-name <EKS_CLUSTER_NAME> --principal-arn $AgentRoleArnYou should see the agent's role in the list, and AmazonEKSAdminPolicy with "type": "namespace" and the namespaces.
#The namespace
KIMS creates it, because it needs cluster-wide rights. One per environment: kims (production, from main) and kims-uat (UAT, from the uat branch, only if KIMS has UAT). The platform job picks the namespace from the branch when its NAMESPACE parameter is empty.
kubectl create namespace kims
kubectl label namespace kims pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/warn=restrictedkubectl create namespace kims
kubectl label namespace kims pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/warn=restrictedkubectl create namespace kims
kubectl label namespace kims pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/warn=restrictedThe labels are optional. The chart's own pods pass restricted, but the one-off content load pod (deploy/handover/load-bundle-pod.yaml) does not, so restricted enforced would refuse it (Content load).
If KIMS sets a ResourceQuota, it must allow at least what the chart requests at its busiest: about 2 CPU and 4 GiB requested, 7 CPU and 7 GiB in limits (two CMS pods during a rollout, the worker, CronJobs and the migrate Job, from deploy/helm/kims/values.yaml).
#The IAM OIDC provider (for IRSA)
IRSA lets a pod's Kubernetes service account become an IAM role. It needs one IAM OIDC identity provider per cluster, which is a cluster-wide setting KIMS's platform team usually already has.
#Check it exists
ISSUER=$(aws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.identity.oidc.issuer --output text)
echo "$ISSUER"
OIDC_ID=${ISSUER##*/}
aws iam list-open-id-connect-providers --output text | grep "$OIDC_ID" || echo "NO PROVIDER"ISSUER=$(aws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.identity.oidc.issuer --output text)
echo "$ISSUER"
OIDC_ID=${ISSUER##*/}
aws iam list-open-id-connect-providers --output text | grep "$OIDC_ID" || echo "NO PROVIDER"$Issuer = aws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.identity.oidc.issuer --output text
$Issuer
$OidcId = $Issuer.Split('/')[-1]
$found = aws iam list-open-id-connect-providers --output text | Select-String $OidcId
if ($found) { $found } else { "NO PROVIDER" }The issuer looks like https://oidc.eks.ap-south-2.amazonaws.com/id/<OIDC_ID>. You should see a provider ARN ending in that id. Write the id down: the trust policy needs it.
Console: EKS > the cluster > Overview tab > OpenID Connect provider URL. Then IAM > Identity providers: one of them should have that URL.
#Create it (KIMS's platform team, only if missing)
Console: IAM > Identity providers > Add provider > OpenID Connect > Provider URL: the issuer URL > Audience: sts.amazonaws.com > Add provider.
aws iam create-open-id-connect-provider --url "$ISSUER" --client-id-list sts.amazonaws.comaws iam create-open-id-connect-provider --url "$ISSUER" --client-id-list sts.amazonaws.comaws iam create-open-id-connect-provider --url $Issuer --client-id-list sts.amazonaws.com#The app's service account and its IAM role
The Helm chart creates a service account named after the release, kims (deploy/helm/kims/templates/serviceaccount.yaml, kims.serviceAccountName), in the environment's namespace. When serviceAccount.roleArn is set, it adds the annotation:
metadata:
name: kims
annotations:
eks.amazonaws.com/role-arn: arn:aws:iam::<AWS_ACCOUNT_ID>:role/kims-app-prodThe CMS, worker and CronJob pods run as this service account, and the content load pod uses it too. The kims-migrate Job uses the namespace's default service account: it only needs the database.
The role is created on the IAM page. Its trust policy must name exactly system:serviceaccount:kims:kims (UAT: system:serviceaccount:kims-uat:kims). It allows the assets bucket only: on main the pods never touch the website bucket or CloudFront.
#IRSA or EKS Pod Identity
| IRSA | EKS Pod Identity | |
|---|---|---|
| What the chart supports | Yes: serviceAccount.roleArn writes the annotation |
Not in the chart, but it needs nothing from the chart |
| Set-up | OIDC provider, trust policy naming the service account, annotation | The eks-pod-identity-agent add-on, a role trusting pods.eks.amazonaws.com, and a Pod Identity association (namespace kims, service account kims, role) |
| Fargate | Works | Not supported |
| Tested with KIMS v2 | Local kind rehearsal used static keys; IRSA is the documented path | Not tested |
Use IRSA, which is what the chart and every KIMS v2 document assume. If KIMS's platform team insists on Pod Identity: leave serviceAccount.roleArn empty, create the association in EKS > the cluster > Access tab > Pod Identity associations > Create, and use the Pod Identity trust policy on the IAM page. The AWS SDK in the image picks up either kind of credentials by itself.
#Check the pods got the role
After the first deploy (First deploy):
kubectl -n kims get serviceaccount kims -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}'; echo
kubectl -n kims exec deploy/kims-cms -- env | grep -E '^AWS_(ROLE_ARN|WEB_IDENTITY_TOKEN_FILE|REGION)'kubectl -n kims get serviceaccount kims -o jsonpath='{.metadata.annotations.eks\.amazonaws\.com/role-arn}'; echo
kubectl -n kims exec deploy/kims-cms -- env | grep -E '^AWS_(ROLE_ARN|WEB_IDENTITY_TOKEN_FILE|REGION)'kubectl -n kims get serviceaccount kims -o jsonpath="{.metadata.annotations.eks\.amazonaws\.com/role-arn}"
kubectl -n kims exec deploy/kims-cms -- env | Select-String '^AWS_(ROLE_ARN|WEB_IDENTITY_TOKEN_FILE|REGION)'You should see the role ARN, then AWS_ROLE_ARN=... and AWS_WEB_IDENTITY_TOKEN_FILE=/var/run/secrets/eks.amazonaws.com/serviceaccount/token. If those two variables are missing, the pod started before the annotation existed: kubectl -n kims rollout restart deploy/kims-cms deploy/kims-worker.
The real test is the media library: upload an image, and its sizes appear within a minute. A role problem shows as AccessDenied in kubectl -n kims logs deploy/kims-worker.
#Ingress for the CMS
The CMS needs a way in from outside the cluster: an ingress, a TLS certificate, and a DNS name. See what the cluster has:
kubectl get ingressclass
kubectl -n kube-system get deployment aws-load-balancer-controllerkubectl get ingressclass
kubectl -n kube-system get deployment aws-load-balancer-controllerkubectl get ingressclass
kubectl -n kube-system get deployment aws-load-balancer-controller| What you see | What to do |
|---|---|
An alb class, and the controller READY 2/2 |
Use the ALB values below |
nginx or another class |
Use it the way KIMS's other services do: their annotations, their TLS Secret in cms.ingress.tlsSecretName |
| No ingress class | The cluster has no way in. Installing the AWS Load Balancer Controller is a change to KIMS's whole cluster that their platform team makes. Raise it on arrival: sign-in cannot work until the CMS has its host name |
#The Helm values for an ALB
From main's runbook, AWS set-up H. The chart's CMS Service is a ClusterIP (port 80 to the pod's 3000), which is why the target type must be ip: the ALB sends traffic straight to the pod IPs.
cms:
ingress:
enabled: true
className: alb
host: <CMS_HOST>
tlsSecretName: "" # TLS ends at the load balancer
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing # internal if the CMS is VPN only
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
alb.ingress.kubernetes.io/ssl-redirect: "443"
alb.ingress.kubernetes.io/certificate-arn: <CMS_CERTIFICATE_ARN>
alb.ingress.kubernetes.io/healthcheck-path: /api/health| Choice | Value |
|---|---|
scheme |
internet-facing if editors reach the CMS from the internet; internal if it is VPN only. With internal, Keycloak and the editors must have a route into the VPC |
certificate-arn |
A certificate in the cluster's region, not us-east-1 (Certificates and DNS) |
healthcheck-path |
/api/health answers 200 with no database call (docs/CONFIG.md, Process mode) |
Optional: alb.ingress.kubernetes.io/group.name |
Only if KIMS shares one ALB between services; use their group name |
Optional: alb.ingress.kubernetes.io/inbound-cidrs |
Limit who can reach an internet-facing CMS, for example KIMS's office ranges. Keycloak's address must be included for back-channel logout |
The subnets the controller places the ALB in are found by tag: public subnets tagged kubernetes.io/role/elb=1, private ones kubernetes.io/role/internal-elb=1. If the ingress never gets an address, these tags are the usual cause.
#Check the ingress and point the DNS at it
After the first deploy:
kubectl -n kims get ingress
kubectl -n kims describe ingress kims-cms | tail -n 20kubectl -n kims get ingress
kubectl -n kims describe ingress kims-cms | tail -n 20kubectl -n kims get ingress
kubectl -n kims describe ingress kims-cms | Select-Object -Last 20You should see kims-cms with an ADDRESS like k8s-kims-kimscms-0123456789-1234567890.ap-south-2.elb.amazonaws.com (it takes one to three minutes), and the events end with Successfully reconciled.
KIMS's DNS team then adds a CNAME from <CMS_HOST> to that address (or a Route 53 alias A record). Keycloak's redirect URIs use this host (Keycloak client), so it must resolve before anyone signs in. Check:
curl -sS https://<CMS_HOST>/api/healthcurl -sS https://<CMS_HOST>/api/healthcurl.exe -sS https://<CMS_HOST>/api/healthYou should see a small JSON answer with "status". A certificate error means the ALB's certificate does not cover the host.
#Node architecture
The platform job builds linux/amd64,linux/arm64 by default. Building only the nodes' architecture is faster.
kubectl get nodes -L kubernetes.io/archkubectl get nodes -L kubernetes.io/archkubectl get nodes -L kubernetes.io/archThe last column is amd64 or arm64. Set the job's PLATFORMS to linux/amd64 or linux/arm64 to match (Platform job). If the cluster has both, keep the default.
Also check the cluster version, so kubectl on the agent is within one minor version: aws eks describe-cluster --name <EKS_CLUSTER_NAME> --query cluster.version --output text. The chart needs Kubernetes 1.27 or later (kubeVersion in Chart.yaml).
#If it goes wrong
| What you see | Likely cause | What to do |
|---|---|---|
error: You must be logged in to the server (Unauthorized) |
Your principal has no access entry, or the SSO session ended | aws sts get-caller-identity; ask KIMS for an access entry; aws sso login |
couldn't get current server API group list ... i/o timeout |
The cluster endpoint is private and you are not on KIMS's network or VPN | Connect to the VPN, or work from a machine inside |
Platform job: Error: ... is forbidden: User "arn:aws:sts::...:assumed-role/..." cannot ... |
The agent's role has no access policy for the namespace | Give the Jenkins agent's role deploy access |
Platform job: AccessDeniedException ... eks:DescribeCluster |
The agent's role lacks eks:DescribeCluster |
IAM, platform job |
Worker logs WebIdentityErr or Not authorized to perform sts:AssumeRoleWithWebIdentity |
Trust policy names another namespace or service account, or the OIDC id is wrong | The sub must be system:serviceaccount:<namespace>:kims |
Worker logs AccessDenied on s3:PutObject |
The role's policy lacks the bucket, or a bucket or endpoint policy denies it | IAM, S3 gateway endpoint |
No AWS_ROLE_ARN in the pod |
serviceAccount.roleArn empty, or pods older than the annotation |
Fix the values; kubectl rollout restart |
Ingress has no ADDRESS after five minutes |
No controller, wrong class, or subnets not tagged | kubectl -n kims describe ingress kims-cms events; the subnet tags above |
| ALB targets unhealthy | Wrong target type or health check path | target-type: ip, healthcheck-path: /api/health; the pods must be Ready |
| Browser shows the wrong certificate on the CMS | certificate-arn missing or for another host, or in another region |
Use the CMS certificate in the cluster's region |
Content load pod refused: violates PodSecurity "restricted" |
Namespace enforces restricted |
Enforce baseline (above), or ask KIMS for an exception for that pod |
#Sources
kims-v2/docs/ON-SITE-DEPLOYMENT.mdonmain(Production and UAT; AWS set-up F, G and H)kims-v2/deploy/jenkins/README.md,kims-v2/deploy/jenkins/Jenkinsfile.platformonmainkims-v2/deploy/helm/kims/values.yaml,values-production.example.yaml,templates/serviceaccount.yaml,templates/_helpers.tpl,templates/cms-ingress.yaml,templates/cms-service.yaml,Chart.yamlkims-v2/deploy/handover/load-bundle-pod.yaml- https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
- https://docs.aws.amazon.com/eks/latest/userguide/access-entries.html
- https://docs.aws.amazon.com/eks/latest/userguide/access-policy-permissions.html
- https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html
- https://docs.aws.amazon.com/eks/latest/userguide/associate-service-account-role.html
- https://docs.aws.amazon.com/eks/latest/userguide/service-accounts.html
- https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html
- https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html
- https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/
- https://docs.aws.amazon.com/eks/latest/userguide/network-load-balancing.html