Template Usage Guide
Creating a New Project from This Template
This repository is designed as a GitHub template to bootstrap new Kubernetes-based projects quickly.
Why Use This Template?
- ✅ Production-ready infrastructure from day one
- ✅ Best practices baked in
- ✅ Fully documented and tested
- ✅ Customizable for your needs
- ✅ AI-assisted configuration with GitHub Copilot
Creating from Template
Option 1: GitHub Web UI
- Navigate to github.com/ianlintner/green_field_cluster
- Click the "Use this template" button (green button at top right)
- Select "Create a new repository"
- Enter your project details:
- Repository name (e.g.,
my-awesome-project) - Description
- Public or Private
- Click "Create repository from template"
Option 2: GitHub CLI
Option 3: Using git directly
# Clone the template
git clone https://github.com/ianlintner/green_field_cluster.git my-project
cd my-project
# Remove the original remote
git remote remove origin
# Add your new repository as remote
git remote add origin https://github.com/yourusername/my-project.git
# Push to your new repository
git push -u origin main
Customization Workflow
1. Initial Setup
After creating your repository from the template:
cd my-project
# Update project information
# Edit these files:
# - README.md (update project name and description)
# - mkdocs.yml (update site_name, repo_url)
# - helm/greenfield-cluster/Chart.yaml (update name, description)
2. Configure with Copilot
Open your project in an IDE with GitHub Copilot enabled and describe your requirements:
Example Copilot Prompts
For a new SaaS application:
"@copilot I'm building a SaaS application that needs: - PostgreSQL for user data - Redis for sessions - Kafka for event processing - Remove MySQL and MongoDB (not needed)
Please help me customize the cluster configuration."
For a microservices platform:
"@copilot I need to set up this cluster for a microservices platform with: - 5 microservices (auth, api, processor, notifier, analytics) - Each service needs OpenTelemetry tracing - PostgreSQL for each service database - Kafka for inter-service communication
Can you help me add the manifests for these services?"
3. Deployment Workflow
Template] --> B[Customize with
Copilot] B --> C[Configure
Secrets] C --> D[Deploy to
Cluster] D --> E[Verify
Deployment] E --> F[Configure
Ingress] F --> G[Production
Ready] style A fill:#4CAF50 style B fill:#2196F3 style D fill:#FF9800 style G fill:#9C27B0
Common Customizations
Remove Unused Components
If you don't need certain databases:
Edit kustomize/base/kustomization.yaml:
Add Your Application
Create manifests for your application:
# Create your app directory
mkdir -p kustomize/base/my-app
# Add manifests
cat > kustomize/base/my-app/deployment.yaml << 'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
namespace: greenfield
spec:
replicas: 2
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: my-registry/my-app:latest
ports:
- containerPort: 8080
env:
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://otel-collector:4317"
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: my-app-secret
key: database-url
EOF
Adjust Resource Sizes
For different environments, modify the overlays:
# kustomize/overlays/prod/kustomization.yaml
resources:
- ../../base
replicas:
- name: my-app
count: 10 # Scale up for production
patches:
- target:
kind: Deployment
name: my-app
patch: |-
- op: replace
path: /spec/template/spec/containers/0/resources/limits/memory
value: 2Gi
Working with Copilot in Template Repos
Best Practices for Copilot Instructions
When working with this template, use these patterns:
-
Provide Context: Always mention you're working with a template
-
Be Specific: Describe exactly what you need
-
Reference Existing Patterns: Point to similar components
-
Ask for Best Practices: Leverage Copilot's knowledge
Example: Adding a New Service
Using Copilot to Add Services
-
Open a new file:
kustomize/base/user-service/deployment.yaml -
Type a comment describing what you need:
-
Copilot will suggest the complete manifest based on the template patterns!
Deployment After Customization
Once you've customized your cluster:
# Validate your changes
make validate
# Deploy to development
kubectl apply -k kustomize/overlays/dev/
# Or deploy with Helm
helm install my-project helm/greenfield-cluster \
--namespace my-project \
--create-namespace
Continuous Customization
As your project evolves:
- Add new components as needed
- Scale resources based on load
- Update configurations for optimization
- Leverage Copilot for ongoing development
Getting Help
- Use
@copilotin your IDE for suggestions - Check the Examples for common patterns
- Review Architecture for understanding component interactions
- See Best Practices for production guidelines
Template Maintenance
To keep your project updated with template improvements:
# Add the template as a remote
git remote add template https://github.com/ianlintner/green_field_cluster.git
# Fetch template updates
git fetch template
# Cherry-pick or merge specific improvements
git cherry-pick <commit-hash>
Selective Updates
Don't blindly merge all template updates. Review changes carefully and selectively apply improvements that benefit your project.