GitOps - Single YAML Definition
Use a single YAML file to automate, reproduce, and manage your Kubernetes clusters with Ankra and GitOps.
Define your whole cluster: configuration, manifests, and add-ons in a single YAML file. This makes it easy to automate deployments, trigger changes from CI/CD, and quickly spin up new environments when you need them.
When Should You Use a Single YAML File?
Use a single YAML file when you want everything about your cluster in one place:
- Quickly spin up or tear down clusters for testing, demos, or development.
- Keep your setup simple. If it fits in one file, this is the way to go.
- Share or move your cluster definition between teams or environments.
- Keep things portable and easy to version in Git.
Tip: If your project grows or you need more modularity, you can always switch to the multiple YAML (include paths) approach later.
What is a Single YAML GitOps File?
A single YAML GitOps file is just one file that describes everything your cluster needs: configuration, manifests, and add-ons. You keep it in your Git repo, and Ankra uses it to set up and manage your cluster. Usually, manifests and values are base64-encoded right in the file. This makes your setup easy to share, move, and keep in sync.
How DevOps and Developers Use Single YAML Cluster Stacks
DevOps
- Build and maintain cluster stacks with best practices, security, and compliance baked in.
- Update stacks as requirements change, and manage them through pull requests and code reviews.
CI/CD Pipelines
- Automate cluster creation, updates, and rollbacks as part of your software delivery process.
- Every change is tracked and auditable.
Developers
- Instantly spin up consistent, production-like environments for development, testing, or demos.
- No more “it works on my machine” problems. Just point to the right YAML file and go.
Pro Tip: This approach streamlines the entire software lifecycle, from development to production. It makes it easy to reproduce, update, and manage clusters at every stage.
CI/CD Automation
Trigger cluster changes automatically from your Git repository. Every commit can update your cluster, making continuous delivery simple and reliable.
On-Demand Environments
Spin up new clusters or restore existing ones instantly. With everything in one file, you can reproduce environments for testing, staging, or disaster recovery.
Great Reproducibility & Audit
Keep a full history of every change. Roll back, audit, or share your cluster setup with confidence. Your YAML file is the single source of truth.
Example: Single YAML Definition
YAML Breakdown
Line/Key | Description |
---|---|
apiVersion: v1 | Specifies the API version for the resource. |
kind: ImportCluster | Declares the type of resource to create (an imported cluster). |
metadata | Metadata about the cluster resource. |
metadata.name | The name of your cluster. |
metadata.description | A human-readable description for your cluster. |
spec | The main specification for the cluster. |
spec.git_repository | Details of the Git repository to sync from. |
spec.git_repository.provider | The Git provider (e.g., github, gitlab). |
spec.git_repository.credential_name | The credential to use for accessing the repo. |
spec.git_repository.branch | The branch to watch for changes. |
spec.git_repository.repository | The repository path (org/repo). |
spec.stacks | List of stacks to deploy to the cluster. |
stacks[].name | Name of the stack. |
stacks[].description | Description of the stack. |
stacks[].manifests | List of manifests to apply. |
manifests[].name | Name of the manifest. |
manifests[].manifest_base64 | The manifest YAML, base64-encoded. |
manifests[].namespace | Namespace for the manifest. |
manifests[].parents | Dependencies for this manifest. |
stacks[].addons | List of add-ons to install. |
addons[].name | Name of the add-on. |
addons[].chart_name | Helm chart name for the add-on. |
addons[].chart_version | Version of the Helm chart. |
addons[].repository_url | URL of the Helm chart repository. |
addons[].namespace | Namespace for the add-on. |
addons[].configuration_type | How the add-on is configured (e.g., standalone). |
addons[].configuration.values_base64 | Helm values.yaml, base64-encoded. |
addons[].parents | Dependencies for this add-on. |
How It Works
- Ankra watches your Git repository for changes.
- When you update your YAML file, Ankra automatically syncs your cluster to match the desired state.
- You can use this approach for simple, portable, and fully reproducible cluster setups.
Tip: Use base64 encoding for manifest and values content in single YAML files to keep everything self-contained and portable.