Dynamic Environment Provisioning
Automate complete environment setup by deploying infrastructure and applications together using GitOps catalogs.
Overview
Traditional environment creation requires manual steps:
- Provision infrastructure (networks, databases, storage)
- Deploy platform tools (monitoring, security)
- Configure applications
- 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:
- Create Environment: Define a new environment in Konstruct
- Select Catalogs: Choose IAC and/or YAML catalogs to deploy
- Configure Parameters: Provide values for catalog parameters
- Automated Deployment: Konstruct operator deploys catalogs automatically
- Environment Ready: Complete environment with infrastructure and applications
Deployment Sequence
Catalogs deploy in phases to ensure proper dependencies:
Phase 1: Infrastructure Provisioning (IAC Catalogs)
- IAC catalogs deploy to platform GitOps repository
- Crossplane executes Terraform to provision resources
- Operator waits for all infrastructure to reach
Availablestate
Phase 2: Application Deployment (YAML Catalogs)
- YAML catalogs deploy to application GitOps repository
- ArgoCD syncs applications to target clusters
- 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
- Dynamic provisioning prerequisites completed
- At least one catalog created
- Target cluster configured in Konstruct
Create Environment with Catalogs
Step 1: Navigate to Environments
-
Click Environments in the left sidebar
-
Click Add Environment
Step 2: Configure Environment
- 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
-
Toggle Provision with catalogs
-
Select catalogs to deploy:
- Choose IAC catalogs for infrastructure
- Choose YAML catalogs for applications
- Choose Hybrid catalogs for both
-
Configure catalog parameters:
- Fill in required fields
- Provide optional parameters
- Enter secret values
Step 4: Create Environment
-
Review configuration summary
-
Click Create Environment
-
Konstruct automatically:
- Creates environment definition
- Deploys selected catalogs
- Monitors provisioning status
Monitor Provisioning
View Environment Status
Navigate to Environments to see provisioning status:
| State | Description | Next Action |
|---|---|---|
| Creating | Environment definition created | Wait |
| Provisioning Infrastructure | IAC catalogs deploying | Monitor Crossplane |
| Infrastructure Ready | Infrastructure available | - |
| Deploying Applications | YAML catalogs deploying | Monitor ArgoCD |
| Ready | Environment fully provisioned | Use environment |
| Failed | Provisioning error | Check 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:
rds-postgres(IAC) - PostgreSQL databasedatadog-agent(YAML) - Monitoringsample-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
-
Click Environments in the left sidebar
-
Find the environment to delete
Step 2: Delete Environment
-
Click Delete next to the environment
-
Confirm deletion
Step 3: Automatic Cleanup
Konstruct operator automatically:
- Deletes YAML catalog deployments (ArgoCD applications)
- Deletes IAC catalog deployments (runs Terraform destroy)
- Removes files from GitOps repositories
- 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:
- Verify IAC catalogs reached
Availablestate - Check if YAML catalog deployment started
- Review operator logs for errors
What's Next?
- View detailed provisioning steps
- Create catalogs for your environments
- Learn about catalog types
- Deploy catalogs manually