Deploying Applications
Production deployment patterns from Kubernetes to serverless and edge functions. Bridges the gap from application assembly to production infrastructure.
When to Use
Use when:
- Deploying applications to production infrastructure
- Setting up CI/CD pipelines and GitOps workflows
- Choosing between Kubernetes, serverless, or edge deployment
- Implementing Infrastructure as Code (Pulumi, OpenTofu, SST)
- Migrating from manual deployment to automated infrastructure
Multi-Language Support
This skill provides patterns for:
- Infrastructure as Code: Pulumi (TypeScript), OpenTofu (HCL), SST v3 (TypeScript)
- GitOps: ArgoCD, Flux (Kubernetes)
- Serverless: Vercel (Next.js), AWS Lambda, Cloud Functions
- Edge: Cloudflare Workers (Hono), Deno Deploy
Deployment Strategy Decision Tree
WORKLOAD TYPE?
├── COMPLEX MICROSERVICES (10+ services)
│ └─ Kubernetes + ArgoCD/Flux (GitOps)
│ ├─ Helm 4.0 for packaging
│ ├─ Service mesh: Linkerd (5-10% overhead) or Istio (25-35%)
│ └─ See references/kubernetes-patterns.md
├── VARIABLE TRAFFIC / COST-SENSITIVE
│ └─ Serverless
│ ├─ Database: Neon/Turso (scale-to-zero)
│ ├─ Compute: Vercel, AWS Lambda, Cloud Functions
│ ├─ Edge: Cloudflare Workers (under 5ms cold start)
│ └─ See references/serverless-dbs.md
├── CONSISTENT LOAD / PREDICTABLE TRAFFIC
│ └─ Containers (ECS, Cloud Run, Fly.io)
│ ├─ ECS Fargate: AWS-native, serverless containers
│ ├─ Cloud Run: GCP, scale-to-zero containers
│ └─ Fly.io: Global edge, multi-region
├── GLOBAL LOW-LATENCY (under 50ms)
│ └─ Edge Functions + Edge Database
│ ├─ Cloudflare Workers + D1 (SQLite)
│ ├─ Deno Deploy + Turso (libSQL)
│ └─ See references/edge-functions.md
└── RAPID PROTOTYPING / STARTUP MVP
└─ Managed Platform as a Service
├─ Vercel (Next.js, zero-config)
├─ Railway (any framework)
└─ Render (auto-deploy from Git)
Core Concepts
Infrastructure as Code (IaC)
Define infrastructure using code instead of manual configuration.
Primary: Pulumi (TypeScript)
- TypeScript-first (same language as React/Next.js)
- Multi-cloud support (AWS, GCP, Azure, Cloudflare)
- Trust score: 94.6/100, 9,525 code snippets
Alternative: OpenTofu (HCL)
- CNCF project, Terraform-compatible
- MPL-2.0 license (open governance)
- Drop-in Terraform replacement
Serverless: SST v3 (TypeScript)
- Built on Pulumi
- Optimized for AWS Lambda, API Gateway
- Live Lambda development
GitOps Deployment
Declarative infrastructure with Git as source of truth.
ArgoCD (Recommended for platform teams):
- Rich web UI
- Built-in RBAC and multi-tenancy
- Self-healing deployments
Flux (Recommended for DevOps automation):
- Kubernetes-native
- CLI-focused
- Simpler architecture
Service Mesh
Optional layer for microservices communication, security, and observability.
When to Use Service Mesh:
- Multi-team microservices (security boundaries)
- Zero-trust networking (mTLS required)
- Advanced traffic management (canary, blue-green)
When NOT to Use:
- Simple monolith or 2-3 services (overhead not justified)
- Serverless architectures (incompatible)
Linkerd (Performance-focused):
- 5-10% overhead
- Rust-based
- Simple, opinionated
Istio (Feature-rich):
- 25-35% overhead
- C++ (Envoy)
- Advanced routing, observability
Quick Start Workflows
Workflow 1: Deploy Next.js to Vercel (Zero-Config)
# Install Vercel CLI
npm i -g vercel
# Link project
vercel link
# Deploy to production
vercel --prod
Workflow 2: Deploy to Kubernetes with ArgoCD
- Create Helm chart
- Push chart to Git repository
- Create ArgoCD Application
- ArgoCD syncs automatically
Workflow 3: Deploy Serverless with Pulumi
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Create Lambda function
const lambda = new aws.lambda.Function("api", {
runtime: "nodejs20.x",
handler: "index.handler",
role: role.arn,
code: new pulumi.asset.FileArchive("./dist"),
});
export const apiUrl = lambda.invokeArn;
Workflow 4: Deploy Edge Function to Cloudflare Workers
import { Hono } from 'hono'
const app = new Hono()
app.get('/api/hello', (c) => {
return c.json({ message: 'Hello from edge!' })
})
export default app
Deploy with Wrangler:
wrangler deploy
Serverless Databases
| Database | Type | Key Feature | Best For |
|---|---|---|---|
| Neon | PostgreSQL | Database branching, scale-to-zero | Development workflows, preview environments |
| PlanetScale | MySQL | Non-blocking schema changes | MySQL apps, zero-downtime migrations |
| Turso | SQLite | Edge deployment, low latency | Edge functions, global distribution |
Edge Functions
Cloudflare Workers:
- Under 5ms cold starts (V8 isolates)
- 200+ edge locations
- 128MB memory per request
Deno Deploy:
- TypeScript-native
- Web Standard APIs
- Global edge (under 50ms)
Hono Framework:
- Runs on all edge runtimes
- 14KB bundle size
- TypeScript-first
Best Practices
Security
- Use secrets management (AWS Secrets Manager, Vault)
- Enable mTLS for service-to-service communication
- Implement least-privilege IAM roles
- Scan container images for vulnerabilities
Cost Optimization
- Use serverless databases for variable traffic (scale-to-zero)
- Enable horizontal pod autoscaling (HPA) in Kubernetes
- Right-size compute resources (CPU/memory)
- Use spot instances for non-critical workloads
Performance
- Deploy close to users (edge functions for global apps)
- Use CDN for static assets (CloudFront, Cloudflare)
- Implement caching strategies (Redis, CloudFront)
- Monitor cold start times for serverless
Reliability
- Implement health checks (Kubernetes liveness/readiness probes)
- Set up auto-scaling (HPA, Lambda concurrency)
- Use multi-region deployments for critical services
- Implement circuit breakers and retries
Troubleshooting
Deployment Failures
Kubernetes pod fails to start:
- Check pod logs:
kubectl logs <pod-name> - Describe pod:
kubectl describe pod <pod-name> - Verify resource limits and requests
- Check image pull errors (imagePullSecrets)
Serverless cold starts too slow:
- Reduce bundle size (tree-shaking, code splitting)
- Use provisioned concurrency (AWS Lambda)
- Consider edge functions (Cloudflare Workers)
- Optimize initialization code
GitOps sync errors (ArgoCD/Flux):
- Verify Git repository access
- Check manifest validity (
kubectl apply --dry-run) - Review sync policies (prune, selfHeal)
- Check ArgoCD/Flux logs
Migration Patterns
From Manual to IaC
- Inventory existing infrastructure
- Start with non-critical environments (dev, staging)
- Use Pulumi/OpenTofu to codify infrastructure
- Test in staging before production
- Gradual migration (one service at a time)
From Terraform to OpenTofu
# Install OpenTofu
brew install opentofu
# Migrate state
terraform state pull > terraform.tfstate.backup
tofu init -migrate-state
tofu plan
tofu apply
From EC2 to Containers
- Containerize application (create Dockerfile)
- Test locally (Docker Compose)
- Deploy to staging (ECS/Cloud Run/Kubernetes)
- Monitor performance and costs
- Cutover production traffic (blue-green deployment)
From Containers to Serverless
- Identify stateless services
- Refactor to serverless-friendly patterns
- Use serverless databases (Neon/Turso)
- Deploy to Lambda/Cloud Functions
- Monitor cold starts and costs
Integration with Other Skills
This skill provides deployment strategies for:
- API Patterns: Deploy REST/GraphQL APIs
- Databases: Deploy PostgreSQL, MongoDB, vector databases
- Real-time Sync: Deploy WebSocket/SSE servers
- Observability: Deploy LGTM stack (Loki, Grafana, Tempo, Mimir)
- AI/ML: Deploy vLLM model serving, RAG pipelines
Related Skills
- API Patterns - Deploy backend APIs
- Observability - Deploy monitoring infrastructure
- Model Serving - Deploy LLM serving infrastructure
- Relational Databases - Deploy PostgreSQL/MySQL
References
- Full Skill Documentation
- Pulumi: https://www.pulumi.com/
- OpenTofu: https://opentofu.org/
- ArgoCD: https://argo-cd.readthedocs.io/
- Cloudflare Workers: https://workers.cloudflare.com/
- Neon: https://neon.tech/