Skip to main content
Version: 0.3

Dynamic Environment Provisioning

Automate complete environment setup by deploying infrastructure and applications together using GitOps catalogs.

Overview

Traditional environment creation requires manual steps:

  1. Provision infrastructure (networks, databases, storage)
  2. Deploy platform tools (monitoring, security)
  3. Configure applications
  4. Set up secrets and configurations

Dynamic provisioning automates this entire process using catalogs, reducing environment creation from hours to minutes.

How It Works

Dynamic provisioning orchestrates catalog deployment when creating environments:

  1. Create Environment: Define a new environment in Konstruct
  2. Select Catalogs: Choose IAC and/or YAML catalogs to deploy
  3. Configure Parameters: Provide values for catalog parameters
  4. Automated Deployment: Konstruct operator deploys catalogs automatically
  5. Environment Ready: Complete environment with infrastructure and applications

Deployment Sequence

Catalogs deploy in phases to ensure proper dependencies:

Phase 1: Infrastructure Provisioning (IAC Catalogs)

  1. IAC catalogs deploy to platform GitOps repository
  2. Crossplane executes Terraform to provision resources
  3. Operator waits for all infrastructure to reach Available state

Phase 2: Application Deployment (YAML Catalogs)

  1. YAML catalogs deploy to application GitOps repository
  2. ArgoCD syncs applications to target clusters
  3. Applications connect to provisioned infrastructure

Note: Hybrid catalogs execute both phases sequentially.

Use Cases

Development Environment Stack

Create complete development environments with:

  • IAC: VPC, subnets, RDS database, S3 buckets
  • YAML: Monitoring agents, logging tools
  • Applications: Sample applications for testing

Benefits:

  • Consistent dev environments
  • Fast environment spin-up
  • Easy cleanup

Feature Branch Environments

Automatically provision ephemeral environments for feature branches:

  • Create environment when branch created
  • Deploy infrastructure from catalog
  • Deploy application stack
  • Auto-cleanup when branch merged

Benefits:

  • Isolated testing
  • No manual provisioning
  • Automatic resource cleanup

Customer-Specific Environments

Provision dedicated environments per customer:

  • Tenant-specific infrastructure
  • Custom configurations
  • Consistent deployment pattern

Benefits:

  • Multi-tenancy support
  • Repeatable provisioning
  • Easy scaling

Prerequisites

Create Environment with Catalogs

Step 1: Navigate to Environments

  1. Click Environments in the left sidebar

  2. Click Add Environment

Step 2: Configure Environment

  1. Enter environment details:
    • Name: Unique environment name (e.g., "dev-feature-x")
    • Namespace: Kubernetes namespace
    • Environment Type: Pre-release or Release
    • Description: Optional description

Step 3: Enable Dynamic Provisioning

  1. Toggle Provision with catalogs

  2. Select catalogs to deploy:

    • Choose IAC catalogs for infrastructure
    • Choose YAML catalogs for applications
    • Choose Hybrid catalogs for both
  3. Configure catalog parameters:

    • Fill in required fields
    • Provide optional parameters
    • Enter secret values

Step 4: Create Environment

  1. Review configuration summary

  2. Click Create Environment

  3. Konstruct automatically:

    • Creates environment definition
    • Deploys selected catalogs
    • Monitors provisioning status

Monitor Provisioning

View Environment Status

Navigate to Environments to see provisioning status:

StateDescriptionNext Action
CreatingEnvironment definition createdWait
Provisioning InfrastructureIAC catalogs deployingMonitor Crossplane
Infrastructure ReadyInfrastructure available-
Deploying ApplicationsYAML catalogs deployingMonitor ArgoCD
ReadyEnvironment fully provisionedUse environment
FailedProvisioning errorCheck logs

Check Infrastructure Provisioning

Monitor IAC catalog deployment:

# Check Workspace status
kubectl get workspace -n crossplane-system

# View detailed status
kubectl describe workspace <catalog-name> -n crossplane-system

# Check Terraform logs
kubectl logs -n crossplane-system -l crossplane.io/claim-name=<catalog-name>

Check Application Deployment

Monitor YAML catalog deployment:

# Check ArgoCD applications
kubectl get applications -n argocd

# View application status
kubectl describe application <env>-<app-name> -n argocd

# Check deployed resources
kubectl get pods -n <namespace>

Example: Complete Development Environment

Provision a development environment with database and monitoring:

Configuration:

  • Environment: dev-feature-auth
  • Namespace: dev-feature-auth
  • Type: Pre-release

Catalogs:

  1. rds-postgres (IAC) - PostgreSQL database
  2. datadog-agent (YAML) - Monitoring
  3. sample-app (YAML) - Demo application

Parameters:

rds-postgres (IAC):

  • databaseName: feature_auth_db
  • instanceClass: db.t3.micro
  • allocatedStorage: 20
  • environment: development

datadog-agent (YAML):

  • clusterName: dev-cluster
  • environment: development
  • logsEnabled: true
  • apmEnabled: true

sample-app (YAML):

  • replicas: 2
  • imageTag: latest
  • databaseEndpoint: (from rds-postgres output)

Result:

  • PostgreSQL database provisioned in AWS
  • Datadog monitoring deployed to namespace
  • Sample application deployed with database connection
  • Environment ready for feature development

Cleanup and Deprovisioning

To remove a dynamically provisioned environment:

Step 1: Navigate to Environments

  1. Click Environments in the left sidebar

  2. Find the environment to delete

Step 2: Delete Environment

  1. Click Delete next to the environment

  2. Confirm deletion

Step 3: Automatic Cleanup

Konstruct operator automatically:

  1. Deletes YAML catalog deployments (ArgoCD applications)
  2. Deletes IAC catalog deployments (runs Terraform destroy)
  3. Removes files from GitOps repositories
  4. Cleans up Kubernetes resources

Warning: IAC catalog deletion destroys infrastructure. Ensure data is backed up.

Best Practices

  • Order Dependencies: Deploy infrastructure catalogs before application catalogs
  • Parameter Validation: Validate catalog parameters before environment creation
  • Error Handling: Monitor provisioning and handle failures promptly
  • Resource Cleanup: Delete unused environments to reduce costs
  • Resource Tagging: Tag all provisioned resources with environment identifier
  • Secret Management: Store sensitive data in secret backends, never in code
  • Testing: Test catalogs independently before using in dynamic provisioning

Troubleshooting

Infrastructure Provisioning Failed

Check Workspace status:

kubectl describe workspace <catalog-name> -n crossplane-system

Common issues:

  • Cloud provider permissions insufficient
  • Resource quotas exceeded
  • Invalid Terraform configuration
  • Network connectivity issues

Application Deployment Failed

Check ArgoCD status:

kubectl get applications -n argocd
kubectl describe application <app-name> -n argocd

Common issues:

  • Infrastructure not ready yet (wait for Phase 1)
  • Invalid Helm values
  • Missing secrets
  • Namespace not created

Environment Stuck in Provisioning

Check both phases:

  1. Verify IAC catalogs reached Available state
  2. Check if YAML catalog deployment started
  3. Review operator logs for errors

What's Next?