This guide shows you how to build a CI/CD pipeline that automatically deploys your applications to Kubernetes when you push code. Your CI builds container images and updates the GitOps repository. Ankra handles the rest.
Architecture Overview
The flow works like this:- You push code to your application repository
- CI builds and pushes a container image to your registry
- CI updates the GitOps repo with the new image tag
- Ankra detects the change and triggers a deployment
- Ankra Agent deploys the updated manifest to your cluster
What You’ll Build
A complete CI/CD pipeline with:| Component | Purpose |
|---|---|
| Application Repo | Your app code with Dockerfile and CI workflow |
| GitOps Repo | Kubernetes manifests managed by Ankra |
| Container Registry | Stores your built images (GCR, ECR, Docker Hub, etc.) |
| GitHub Actions | Builds images and updates the GitOps repo |
Prerequisites
- A cluster imported into Ankra with the agent connected
- A container registry (Google Artifact Registry, AWS ECR, Docker Hub, etc.)
- An application repository with a Dockerfile
Step 1: Connect a GitHub Repository
First, connect a GitHub repository to your cluster. This enables GitOps and installs the necessary components on your cluster.Add a GitHub Credential
If you haven’t connected GitHub yet, you’ll see a prompt to connect a repository.Select an existing GitHub credential from the dropdown, or click to add a new one. This authorizes Ankra to access your repositories.
Select a Repository
Choose the repository that will store your GitOps configuration. This can be an existing repo or a new one.
Confirm Installation
When you connect for the first time, Ankra will install:
- ArgoCD - GitOps continuous delivery
- Ankra Stack Builder - Declarative infrastructure management
- Ankra Resource Engine - Intelligent resource orchestration
- GitOps Monitoring - Continuous deployment from your repository
Step 2: Create a Stack for Your Application
In Ankra, manifests are organized into Stacks. A Stack is a collection of related Kubernetes resources that are deployed together.Add a Manifest Using AI
Press The AI will provide a manifest you can add to your stack.
⌘+J (or Ctrl+J) to open the AI Assistant and describe your deployment:Step 3: Set Up CI Deploy Key
Your CI pipeline needs write access to the GitOps repository to update image tags when new builds complete.Generate an SSH Key
On your local machine, generate a deploy key:This creates
deploy_key (private) and deploy_key.pub (public).Add Public Key to GitOps Repo
Go to your GitOps repository on GitHub → Settings → Deploy keys → Add deploy key.Paste the contents of
deploy_key.pub and check Allow write access.Step 4: Create the CI Workflow
Add a GitHub Actions workflow to your application repository that builds your container and updates the GitOps repo.Use the AI to Generate the Workflow
Open the AI Assistant (The AI will generate a complete workflow tailored to your setup.
⌘+J) and describe your pipeline:Example Workflow Reference
Example Workflow Reference
Here’s what a typical workflow looks like. Use the AI to customize it for your specific setup:
Step 5: Configure Registry Access in Your Cluster
If your container registry is private, your cluster needs credentials to pull images.Add the Secret Value
The AI will provide a Secret manifest template. You’ll need to provide your registry credentials:
- For GCP: Use a service account JSON key with
Artifact Registry Readerrole - For AWS ECR: Use an IAM access key
- For Docker Hub: Use your username and access token
Step 6: Test the Pipeline
Verify GitOps Update
After CI completes, check your GitOps repository. You should see a new commit updating the image tag.
Step 7: Monitor GitOps Sync Status
Ankra provides visibility into your GitOps sync status.View GitOps Status
Navigate to your cluster → GitOps to see:
- Current sync status
- Recent sync history
- Any sync errors
Adding More Services
To add CI/CD for additional services, use the AI Assistant to scaffold everything:Add to Existing Stack or Create New
Either edit your existing stack or create a new one for the service.
Common AI Prompts
Use these prompts with the AI Assistant (⌘+J) to set up your CI/CD:
Create a Deployment
Create a Deployment
Create a Complete Service Stack
Create a Complete Service Stack
Add Image Pull Secret
Add Image Pull Secret
Generate CI Workflow
Generate CI Workflow
Add Canary Deployment
Add Canary Deployment
Troubleshoot Deployment
Troubleshoot Deployment
Best Practices
Use Immutable Image Tags
Use Immutable Image Tags
Add Health Checks
Add Health Checks
Let the AI configure proper health checks for your deployments.Ask the AI: “Add appropriate liveness and readiness probes to my backend deployment for a Node.js app”
Set Resource Limits
Set Resource Limits
Prevent runaway resource usage with proper limits.Ask the AI: “Review my deployment and suggest appropriate resource requests and limits based on a typical web API”
Use SOPS for Secrets
Use SOPS for Secrets
Encrypt sensitive values in your GitOps repository.Ask the AI: “Help me encrypt my database password using SOPS”
Troubleshooting
Having issues? Open the AI Assistant (⌘+J) and describe your problem:
CI Can't Push to GitOps Repo
CI Can't Push to GitOps Repo
Ask the AI:
Image Not Updating
Image Not Updating
Ask the AI:
Pods Can't Pull Image
Pods Can't Pull Image
Ask the AI:
Deployment Rollout Stuck
Deployment Rollout Stuck
Ask the AI:
GitOps Sync Not Triggering
GitOps Sync Not Triggering
Check the GitOps page in your cluster to see sync status. If sync isn’t triggering:
- Verify the GitHub repository is still connected in Settings → Integration
- Check that your commit was pushed to the correct branch
- Look for webhook configuration issues in the GitOps status
The AI has access to your pod logs, events, and deployment status. It can pinpoint exactly what’s going wrong and suggest fixes.