Architecture Overview
The flow works like this:- You push code to your GitLab application repository
- GitLab CI builds and pushes a container image to your registry
- GitLab 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:Prerequisites
- A cluster imported into Ankra with the agent connected
- A GitOps repository on GitHub (this guide) or Bitbucket Cloud
- A container registry (GitLab Container Registry, Google Artifact Registry, AWS ECR, Docker Hub, etc.)
- An application repository on GitLab with a Dockerfile
Step 1: Connect a GitOps Repository to the Cluster
Connect the repository that will hold the cluster’s configuration. It must be on GitHub or Bitbucket Cloud.Open the cluster's GitOps settings
Connect the repository
clusters/<cluster-name>-<short-id>/ folder in the repository and keeps it in sync.
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.Open the Stacks Page
Create a New Stack
Name Your Stack
backend-services or production-apps.Add a Manifest Using AI
⌘+J (or Ctrl+J) to open the AI Assistant and describe your deployment:Create the Stack
Step 3: Set Up CI Deploy Key
Your GitLab CI pipeline needs write access to the GitOps repository to update image tags when new builds complete.Generate an SSH Key
deploy_key (private) and deploy_key.pub (public).Add Public Key to GitOps Repo
deploy_key.pub and check Allow write access.Add Private Key to App Repo
- Key:
GITOPS_DEPLOY_KEY - Value: Contents of
deploy_key - Type: File
- Flags: Check Mask variable and Protect variable
Step 4: Create the GitLab CI Pipeline
Add a.gitlab-ci.yml file to your application repository that builds your container and updates the GitOps repo.
Create the Pipeline File
.gitlab-ci.yml at the root.Use the AI to Generate the Pipeline
⌘+J) and describe your pipeline:Add Registry Variables
Example Pipeline: GitLab Container Registry
Example Pipeline: GitLab Container Registry
latest, so each deploy names exactly one build. Use the AI to customise it for your setup:Example Pipeline: Google Artifact Registry
Example Pipeline: Google Artifact Registry
Step 5: Configure Registry Access in Your Cluster
If your container registry is private, your cluster needs credentials to pull images.Open the AI Assistant
⌘+J to open the AI Assistant.Ask for an Image Pull Secret
Add the Secret Value
- For GitLab: Use a Deploy Token with
read_registryscope - For GCP: Use a service account JSON key with
Artifact Registry Readerrole - For AWS ECR: Use an IAM access key
Link to Your Deployment
Step 6: Test the Pipeline
Push a Code Change
Monitor CI Progress
Verify GitOps Update
Watch the Deployment
Step 7: Monitor GitOps Sync Status
Ankra provides visibility into your GitOps sync status.View GitOps Status
- Current sync status
- Recent sync history
- Any sync errors
Trigger Manual Sync
View in Operations
Adding More Services
To add CI/CD for additional services, use the AI Assistant to scaffold everything:Add to Existing Stack or Create New
Generate the Deployment Manifest
⌘+J) and describe your service:Generate the CI Pipeline
.gitlab-ci.yml or ask the AI:Add the Variables
GITOPS_DEPLOY_KEY, registry credentials) to the new project.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
- Deploy key doesn’t have write permissions on the GitOps repo
GITOPS_DEPLOY_KEYvariable is not set as File typessh-keyscanis missing forgithub.com
Image Not Updating
Image Not Updating
Pods Can't Pull Image
Pods Can't Pull Image
read_registry scope.Pipeline Fails on Docker Build
Pipeline Fails on Docker Build
- Use
docker:27as the job image - Add
docker:27-dindas a service - If using Kubernetes executors, ensure privileged mode is enabled or use Kaniko instead
GitOps Sync Not Triggering
GitOps Sync Not Triggering
- Verify the GitOps repository is still connected under the cluster’s Settings → GitOps
- Check that your commit was pushed to the correct branch
- Look for webhook configuration issues in the GitOps status