provisioning-outreach/presentations/pres-prvng/demos/02-kubernetes-deployment-demo.sh

149 lines
6.7 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Demo 2: Kubernetes Taskserv Deployment
# Time: ~1 minute
# Shows: KCL schema validation, dependency resolution, parallel execution
set -e
echo "╔════════════════════════════════════════════════════════╗"
echo "║ Demo 2: Kubernetes Taskserv Deployment ║"
echo "║ Time: ~1 minute ║"
echo "╚════════════════════════════════════════════════════════╝"
echo ""
# Step 1: Show command
echo "Step 1⃣ Deploy Kubernetes taskserv"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "$ provisioning taskserv create kubernetes \\"
echo " --infra demo \\"
echo " --check"
echo ""
sleep 2
# Step 2: KCL Schema Validation
echo "Step 2⃣ KCL Schema Validation (Type-Safe!)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Validating KCL configuration..."
echo ""
echo "✓ Taskserv type: 'kubernetes' (valid)"
echo "✓ Version: '1.28.0' (compatible)"
echo "✓ Requirements: [cilium, containerd] (valid)"
echo "✓ Infrastructure 'demo': exists and accessible"
echo "✓ Compute capacity: sufficient"
echo "✓ KCL schema validation: PASSED"
echo ""
sleep 2
# Step 3: Dependency Resolution
echo "Step 3⃣ Dependency Resolution (Automatic)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Resolving taskserv dependencies..."
echo ""
echo "kubernetes (1.28.0)"
echo " ├─ containerd (1.7.0) ← required"
echo " ├─ cilium (1.14.0) ← required (CNI)"
echo " ├─ etcd (3.5.0) ← internal (auto)"
echo " └─ core-utils ← base deps"
echo ""
echo "Execution Plan:"
echo " 1. containerd (in parallel)"
echo " 2. cilium (in parallel)"
echo " 3. etcd (sequential)"
echo " 4. kubernetes (after etcd)"
echo ""
echo "Parallel efficiency: 75% (4 tasks, 3 in parallel)"
echo ""
sleep 2
# Step 4: Pre-flight checks
echo "Step 4⃣ Pre-flight Checks"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Checking deployment readiness..."
echo ""
echo "✓ Target server exists (web-01)"
echo "✓ Server reachable (SSH OK)"
echo "✓ Disk space: 48GB available (needs 12GB)"
echo "✓ Memory available: 3.2GB (needs 2GB)"
echo "✓ Network connectivity: OK"
echo "✓ Port availability: 6443 (K8s API), 10250 (kubelet) free"
echo "✓ Required binaries available"
echo ""
echo "All pre-flight checks: PASSED ✓"
echo ""
sleep 2
# Step 5: Dry-run output
echo "Step 5⃣ Deployment Plan (Dry-Run Preview)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "┌─────────────────────────────────────────────────────┐"
echo "│ Kubernetes Deployment Plan (Dry-Run) │"
echo "├─────────────────────────────────────────────────────┤"
echo "│ │"
echo "│ Phase 1: Dependency Installation (2 min) │"
echo "│ • containerd + cilium (parallel) ~90 sec │"
echo "│ • etcd initialization ~30 sec │"
echo "│ │"
echo "│ Phase 2: Kubernetes Setup (3 min) │"
echo "│ • Control plane initialization ~100 sec │"
echo "│ • API server startup ~30 sec │"
echo "│ • Core add-ons deployment ~20 sec │"
echo "│ │"
echo "│ Phase 3: Verification (30 sec) │"
echo "│ • Cluster health check ~15 sec │"
echo "│ • Pod readiness verification ~15 sec │"
echo "│ │"
echo "│ ESTIMATED TOTAL TIME: ~5 minutes │"
echo "│ │"
echo "│ Status: ✓ Ready to deploy │"
echo "│ (No changes made - dry-run mode) │"
echo "│ │"
echo "└─────────────────────────────────────────────────────┘"
echo ""
sleep 2
# Step 6: Configuration details
echo "Step 6⃣ Kubernetes Configuration Details"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "API Server:"
echo " • Address: 0.0.0.0:6443"
echo " • TLS: enabled (auto-generated certs)"
echo " • RBAC: enabled"
echo " • Audit logging: enabled"
echo ""
echo "Network:"
echo " • Pod CIDR: 10.244.0.0/16"
echo " • Service CIDR: 10.96.0.0/12"
echo " • DNS: CoreDNS"
echo ""
echo "Storage:"
echo " • Default StorageClass: provisioned"
echo " • Monitoring: prometheus enabled"
echo ""
sleep 2
# Step 7: Summary
echo "Step 7⃣ Summary"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "✓ KCL schema validated (type-safe)"
echo "✓ Dependencies resolved automatically"
echo "✓ Pre-flight checks passed"
echo "✓ Deployment plan verified"
echo "✓ Dry-run successful"
echo ""
echo "To actually deploy Kubernetes, run:"
echo " $ provisioning taskserv create kubernetes --infra demo"
echo ""
echo "Then access with:"
echo " $ kubectl --kubeconfig ~/.provisioning/kubeconfig get nodes"
echo ""
echo "╔════════════════════════════════════════════════════════╗"
echo "║ Key Insight: Parallel execution = 75% faster ║"
echo "║ vs sequential (Ansible, Terraform) ║"
echo "╚════════════════════════════════════════════════════════╝"