Skip to content

Latest commit

 

History

History
295 lines (247 loc) · 11.3 KB

File metadata and controls

295 lines (247 loc) · 11.3 KB

Full-Stack Kubernetes Tutorial - Project Overview

🎯 Project Goals

This tutorial demonstrates building and deploying a complete full-stack application using modern DevOps practices and cloud-native technologies. It covers the entire journey from local development to production deployment on Google Kubernetes Engine (GKE).

🏗️ Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Complete Architecture                     │
├─────────────────────────────────────────────────────────────┤
│  Frontend (Vue 3)     Backend (Go)      Database (PostgreSQL)│
│  ┌─────────────┐     ┌─────────────┐    ┌─────────────┐     │
│  │ • Vue 3     │────▶│ • REST API  │───▶│ • PostgreSQL│     │
│  │ • TypeScript│     │ • GraphQL   │    │ • Cloud SQL │     │
│  │ • Vite      │     │ • Gin       │    │ • Backups   │     │
│  │ • Nginx     │     │ • GORM      │    └─────────────┘     │
│  └─────────────┘     └─────────────┘                        │
│         │                     │                             │
│         ▼                     ▼                             │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │                Docker Containers                        │ │
│  └─────────────────────────────────────────────────────────┘ │
│                              │                              │
│                              ▼                              │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │              Kubernetes Orchestration                   │ │
│  │  • Kind (Local)  • GKE (Production)  • Helm Charts     │ │
│  └─────────────────────────────────────────────────────────┘ │
│                              │                              │
│                              ▼                              │
│  ┌─────────────────────────────────────────────────────────┐ │
│  │                 CI/CD Pipeline                          │ │
│  │  • GitHub Actions  • Terraform  • Security Scanning    │ │
│  └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘

🛠️ Technology Stack

Frontend

  • Vue 3 with Composition API and TypeScript
  • Vite for fast development and building
  • Vue Router for client-side routing
  • Pinia for state management
  • Axios for REST API calls
  • Apollo Client for GraphQL integration

Backend

  • Go 1.21 with modern practices
  • Gin web framework for HTTP handling
  • GORM for database operations
  • GraphQL-Go for GraphQL API
  • PostgreSQL for data persistence

Infrastructure

  • Docker for containerization
  • Kubernetes for orchestration
  • Helm for package management
  • Terraform for infrastructure as code
  • Google Cloud Platform for production hosting

DevOps

  • GitHub Actions for CI/CD
  • Kind for local Kubernetes testing
  • Google Container Registry for image storage
  • Cloud SQL for managed database
  • Monitoring and observability tools

📁 Project Structure

├── frontend/                 # Vue 3 application
│   ├── src/
│   │   ├── views/           # Page components
│   │   ├── components/      # Reusable components
│   │   ├── App.vue          # Root component
│   │   └── main.ts          # Entry point
│   ├── package.json         # Dependencies
│   └── vite.config.ts       # Build configuration
│
├── backend/                 # Go API server
│   ├── internal/
│   │   ├── api/            # REST and GraphQL handlers
│   │   ├── config/         # Configuration management
│   │   ├── database/       # Database connection
│   │   └── models/         # Data models
│   ├── go.mod              # Go dependencies
│   └── main.go             # Application entry point
│
├── docker/                 # Docker configurations
│   ├── Dockerfile.frontend # Frontend container
│   ├── Dockerfile.backend  # Backend container
│   └── nginx.conf          # Nginx configuration
│
├── helm/                   # Helm charts
│   └── tutorial-app/
│       ├── Chart.yaml      # Chart metadata
│       ├── values*.yaml    # Environment configurations
│       └── templates/      # Kubernetes manifests
│
├── terraform/              # Infrastructure as code
│   ├── main.tf            # Main configuration
│   ├── variables.tf       # Input variables
│   └── outputs.tf         # Output values
│
├── .github/               # GitHub Actions workflows
│   └── workflows/
│       ├── ci-cd.yml      # Main CI/CD pipeline
│       └── security-scan.yml # Security scanning
│
├── k8s/                   # Kubernetes manifests
├── scripts/               # Utility scripts
├── docs/                  # Documentation
└── Makefile              # Development commands

🚀 Getting Started

Prerequisites

  • Docker Desktop
  • Node.js 18+
  • Go 1.21+
  • kubectl
  • helm
  • kind
  • terraform (for production)
  • gcloud CLI (for production)

Quick Start

# 1. Clone and setup
git clone <repository-url>
cd full-stack-k8s-tutorial
make setup

# 2. Start local development
make dev-up

# 3. Deploy to local Kubernetes
make kind-setup
make kind-deploy

# 4. Access the application
# Add to /etc/hosts: 127.0.0.1 tutorial-app.local
# Visit: http://tutorial-app.local

📚 Learning Path

Phase 1: Local Development

  1. Frontend Development - Build Vue 3 application
  2. Backend Development - Create Go API with REST and GraphQL
  3. Database Integration - Connect to PostgreSQL
  4. Local Testing - Run with Docker Compose

Phase 2: Containerization

  1. Docker Images - Create optimized containers
  2. Multi-stage Builds - Optimize for production
  3. Container Registry - Push to Google Container Registry
  4. Security Scanning - Vulnerability assessment

Phase 3: Kubernetes Deployment

  1. Local Kubernetes - Deploy with Kind
  2. Helm Charts - Package management
  3. Service Discovery - Internal communication
  4. Ingress Configuration - External access

Phase 4: Production Infrastructure

  1. Terraform Setup - Infrastructure as code
  2. GKE Cluster - Production Kubernetes
  3. Cloud SQL - Managed database
  4. Networking - VPC and security

Phase 5: CI/CD Pipeline

  1. GitHub Actions - Automated workflows
  2. Testing Pipeline - Quality gates
  3. Security Scanning - Vulnerability checks
  4. Deployment Automation - Staging and production

Phase 6: Production Operations

  1. Monitoring - Observability setup
  2. Logging - Centralized log management
  3. Alerting - Incident response
  4. Backup & Recovery - Data protection

🎓 Learning Outcomes

After completing this tutorial, you will understand:

Development Skills

  • Modern frontend development with Vue 3
  • Backend API development with Go
  • Database design and operations
  • RESTful and GraphQL API design

DevOps Skills

  • Container orchestration with Kubernetes
  • Infrastructure as code with Terraform
  • CI/CD pipeline design and implementation
  • Security best practices

Cloud Skills

  • Google Cloud Platform services
  • Managed Kubernetes (GKE)
  • Cloud databases and networking
  • Cost optimization strategies

Operational Skills

  • Monitoring and observability
  • Incident response procedures
  • Backup and disaster recovery
  • Performance optimization

🔧 Key Features Demonstrated

Application Features

  • User management with CRUD operations
  • Dual API support (REST and GraphQL)
  • Real-time data updates
  • Responsive web interface
  • Health checks and monitoring endpoints

Infrastructure Features

  • High availability deployment
  • Auto-scaling capabilities
  • Load balancing and traffic routing
  • SSL/TLS termination
  • Database connection pooling

Security Features

  • Network policies and segmentation
  • Pod security standards
  • Secrets management
  • Vulnerability scanning
  • Audit logging

Operational Features

  • Blue-green deployments
  • Rolling updates
  • Automated backups
  • Monitoring and alerting
  • Log aggregation

📊 Success Metrics

Performance Targets

  • Availability: 99.9% uptime
  • Response Time: < 200ms for 95% of requests
  • Throughput: Handle 1000+ requests per second
  • Error Rate: < 0.1% of total requests

Operational Targets

  • Deployment Time: < 5 minutes for updates
  • Recovery Time: < 15 minutes for incidents
  • Backup Frequency: Daily automated backups
  • Security Scans: Weekly vulnerability assessments

🤝 Contributing

This tutorial is designed to be educational and extensible. Areas for enhancement:

  • Additional frontend frameworks (React, Angular)
  • Alternative backend languages (Python, Node.js)
  • Different cloud providers (AWS, Azure)
  • Advanced monitoring solutions
  • Service mesh integration
  • GitOps workflows

📖 Documentation

Comprehensive documentation is available in the docs/ directory:

  1. Frontend Development
  2. Backend Development
  3. Docker Configuration
  4. Local Kubernetes with Kind
  5. Helm Charts
  6. Terraform Infrastructure
  7. GitHub Actions CI/CD
  8. Production Deployment

🎯 Next Steps

After completing this tutorial, consider exploring:

  • Service Mesh: Istio or Linkerd integration
  • GitOps: ArgoCD or Flux deployment
  • Observability: Prometheus, Grafana, Jaeger
  • Security: Falco, OPA Gatekeeper
  • Multi-cloud: Deployment across providers
  • Edge Computing: CDN and edge deployment

This tutorial provides a solid foundation for modern cloud-native application development and deployment practices.