base_cluster module sets up the foundational infrastructure for a Kubernetes cluster, deploying essential services like Traefik ingress controller, cert-manager for TLS certificates, Prometheus for monitoring, Datadog for observability, and Vault secret synchronization.
Overview
This module provisions the following components:- Traefik: Ingress controller for routing external traffic
- Cert Manager: Automated TLS certificate management with Let’s Encrypt
- Prometheus: Metrics collection and monitoring
- Datadog: Application performance monitoring and observability
- Vault Secret Sync: Synchronizes secrets from HashiCorp Vault to Kubernetes
- Redis Config: ConfigMap for Redis configuration
Module Structure
The module is organized into specialized Terraform files:traefik.tf: Traefik ingress controller deploymentcert-manager.tf: Certificate management setupmonitoring.tf: Prometheus monitoring stackdatadog.tf: Datadog agent deploymentvault-secret-sync.tf: Vault secret synchronizationredis.tf: Redis configuration resourcesvariables.tf: Input variable definitions
Input Variables
Values to provide to the Traefik Helm chart. These configure the ingress controller settings.
Values to provide to the Vault Secret Sync Helm chart. Configures how secrets are synced from Vault to Kubernetes.
Values to provide to the Prometheus Helm chart. Configures monitoring and metrics collection settings.
Values to provide to the Cert Manager Helm chart. Configures TLS certificate management and Let’s Encrypt integration.
Values to provide to the Datadog Helm chart. Configures Datadog agent for application monitoring and observability.
Resources Provisioned
Namespaces
Traefik Ingress Controller
Certificate Manager
- ClusterIssuer for Let’s Encrypt certificate issuance
- Wildcard certificate for Penn Labs domains
Monitoring Stack
Vault Secret Sync
Redis Configuration
Usage Example
Dependencies
This module depends on:- A running Kubernetes cluster
- Helm provider configured
- Kubernetes provider configured
- Access to the specified Helm chart repositories
Notes
- The cert-manager deployment uses
atomic = trueto ensure it’s fully operational before custom resources are applied - A 1-minute sleep is configured after cert-manager deployment to allow proper initialization
- The vault-secret-sync deployment depends on both the monitoring and cert-manager namespaces being created first