3.7 KiB
3.7 KiB
Full Infrastructure Template
This is a comprehensive infrastructure template with multiple server types and advanced configuration examples.
What's Included
- Web servers - 2 frontend web servers
- Database server - Backend database with private networking
- Kubernetes control plane - Control plane node
- Kubernetes workers - 2 worker nodes
- Advanced settings - SSH config, monitoring, backup options
- Comprehensive examples - Multiple server roles and configurations
Server Inventory
| Hostname | Role | Network | Purpose |
|---|---|---|---|
| web-01, web-02 | Web | Public + Private | Frontend application servers |
| db-01 | Database | Private only | Backend database |
| k8s-control-01 | K8s Control | Public + Private | Kubernetes control plane |
| k8s-worker-01, k8s-worker-02 | K8s Worker | Public + Private | Kubernetes compute nodes |
Quick Start
1. Load Required Modules
cd infra/<your-infra-name>
# Load provider
provisioning mod load providers . upcloud
# Load taskservs
provisioning mod load taskservs . kubernetes containerd cilium
# Load cluster configurations (optional)
provisioning mod load clusters . buildkit
2. Customize Configuration
Edit servers.k:
Provider-specific settings:
# Uncomment and adjust for your provider
plan = "2xCPU-4GB" # Server size
storage_size = 50 # Disk size in GB
Task services:
# Uncomment after loading modules
taskservs = [
{ name = "kubernetes", profile = "control-plane" }
{ name = "containerd", profile = "default" }
{ name = "cilium", profile = "default" }
]
Select servers to deploy:
# Choose which server groups to deploy
all_servers = web_servers + db_servers # Web + DB only
# OR
all_servers = k8s_control + k8s_workers # Kubernetes cluster only
# OR
all_servers = web_servers + db_servers + k8s_control + k8s_workers # Everything
3. Deploy
# Test configuration
kcl run servers.k
# Dry-run deployment (recommended)
provisioning s create --infra <name> --check
# Deploy selected servers
provisioning s create --infra <name>
# Or deploy specific server groups
provisioning s create --infra <name> --select web
Architecture Examples
Web Application Stack
Deploy web servers + database:
all_servers = web_servers + db_servers
Kubernetes Cluster
Deploy control plane + workers:
all_servers = k8s_control + k8s_workers
Complete Infrastructure
Deploy everything:
all_servers = web_servers + db_servers + k8s_control + k8s_workers
Advanced Configuration
Network Segmentation
- Public servers: web-01, web-02 (public + private networks)
- Private servers: db-01 (private network only)
- Hybrid: k8s nodes (public for API access, private for pod networking)
Monitoring
Monitoring is pre-configured in settings:
monitoring = {
enabled = True
metrics_port = 9100
log_aggregation = True
}
SSH Configuration
Advanced SSH settings are included:
ssh_config = {
connect_timeout = 30
retry_attempts = 3
compression = True
}
Next Steps
- Customize server specs - Adjust CPU, memory, storage
- Configure networking - Set up firewall rules, load balancers
- Add taskservs - Uncomment and configure task services
- Set up clusters - Deploy Kubernetes or container clusters
- Configure monitoring - Set up metrics and logging
- Implement backup - Configure backup policies
Template Characteristics
- Complexity: High
- Servers: 6 examples (web, database, k8s)
- Pre-configured modules: Examples for all major components
- Best for: Production deployments, complex architectures, learning advanced patterns