Kubernetes Deployment
Overview
With infrastructure and cluster access ready, you now deploy the Confident AI application services. This step covers:
- Preparing Kubernetes manifests provided by Confident AI
- Updating container image tags to the versions provided by Confident AI
- Configuring the ingress with your domain names and TLS settings
- Setting up External Secrets to sync credentials from Azure Key Vault
- Deploying services in the correct order: base config → Redis → application services
- Monitoring deployment status and troubleshooting common issues
After completion, all Confident AI services will be running in your AKS cluster.
How Kubernetes deployments work
Kubernetes uses YAML manifests to describe what you want to run. A Deployment tells Kubernetes:
- What container image to use
- How many replicas (copies) to run
- What environment variables and secrets to inject
- Resource limits (CPU, memory)
When you kubectl apply a manifest, Kubernetes:
- Reads your desired state
- Compares it to current state
- Creates, updates, or deletes resources to match
- Continuously ensures the desired state is maintained
Manifest structure
The Kubernetes manifests are organized by service:
Prepare manifests
Update image tags
Container images are stored in Confident AI’s AWS ECR. Your Confident AI representative will provide the specific version tags to use.
Open each deployment file and update the image field:
Example change in confident-backend/deployment.yaml:
Image tag format: <ecr-account>.dkr.ecr.<region>.amazonaws.com/confidentai/<service>:<version>
The ECR account ID and region are the values provided by Confident AI for ECR access. The version tag (e.g., v1.2.3) is what your representative will provide.
Use exact tags, not “latest.” Always use specific version tags (e.g.,
v1.2.3), not latest. Specific tags ensure reproducible deployments and
make rollbacks possible. Using latest can cause unexpected behavior when
images are updated.
Configure ingress
The ingress defines how external traffic reaches your services. For Azure, this uses NGINX Ingress (not AWS ALB). Edit base/network/ingress.yaml:
Configure TLS
The tls section and cert-manager.io/cluster-issuer annotation tell cert-manager to automatically request and renew certificates:
cert-manager watches for Ingress resources with this annotation and automatically creates Certificate resources, requests certificates from the issuer, and stores them in the specified Kubernetes Secret.
Configure External Secrets
External Secrets syncs credentials from Azure Key Vault into Kubernetes. The configuration needs to match your deployment.
Update the secret store
Edit base/common/external-secrets/secret-store.yaml:
The vaultUrl must match your Key Vault URI (from terraform output key_vault_uri):
Update the secret references
Edit base/common/external-secrets/external-secrets.yaml:
The key field in each secret reference should match the Key Vault secret names created by Terraform. The secrets use hyphenated names (e.g., DATABASE-URL, BETTER-AUTH-SECRET):
Key Vault secret names use hyphens, not underscores. Azure Key Vault doesn’t allow underscores in secret names. The External Secrets config maps hyphenated Key Vault names to underscored Kubernetes secret keys.
Deploy services
Deploy in order to ensure dependencies are available when needed.
Apply network and secrets configuration
The namespace already exists (Terraform created it), but apply the network and secrets configuration:
Wait for secrets to sync
External Secrets needs to pull credentials from Key Vault before pods can start. Watch the sync status:
Wait until STATUS shows SecretSynced:
Press Ctrl+C to stop watching once synced.
Verify the Kubernetes secret was created:
Don’t proceed until secrets are synced. Pods reference this secret for database URLs, API keys, and other credentials. If you deploy before sync completes, pods will fail to start with “secret not found” errors.
Monitor deployment
Watch pod status
All pods should eventually reach Running status with all containers ready:
Backend may restart once during initial deployment. The backend runs database migrations on startup. If the database isn’t ready immediately, it may fail once and then succeed on retry. One or two restarts is normal.
Check events
If pods aren’t starting, check recent events:
Common deployment issues
ImagePullBackOff
The cluster can’t pull the container image. Causes:
- ECR credentials not synced: The CronJob that refreshes ECR tokens hasn’t run yet
- Wrong image tag: The specified version doesn’t exist
- Network issues: Nodes can’t reach ECR
Fix: Manually trigger ECR credential sync:
Wait 30 seconds, then check if pods start pulling images.
ECR tokens expire every 12 hours. The CronJob refreshes them automatically, but on initial deployment, you may need to trigger it manually. If you see ImagePullBackOff after the cluster has been running for a while, the CronJob may have failed—check its logs.
CrashLoopBackOff
The container starts but crashes. Check logs to see why:
Common causes:
External Secrets not syncing
Look at the Status section for error messages. Common issues:
Ingress not getting external IP
After applying the ingress, check if it has an address:
The ADDRESS column should show the NGINX Ingress load balancer IP. If it’s empty:
The EXTERNAL-IP should show the Azure Load Balancer IP. If it shows <pending>:
- NSG blocking: The NSG may not allow inbound traffic on ports 80/443
- Quota issues: Public IP quota may be exhausted
- Azure Policy: Policies may block public IP or Load Balancer creation
Scaling services
Once everything is running, you can scale based on load:
The evals service is most resource-intensive during evaluation runs. If evaluations are slow or timing out, scaling this service usually helps most.
Next steps
After all services are running and healthy, proceed to Verification to test the deployment end-to-end.