Skip to content

Youssef22Ashraf/k8s_depi_program

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Hands-on Labs 🚀

Kubernetes Logo

📚 Overview

This repository contains comprehensive documentation and configuration files for 5 hands-on Kubernetes labs covering fundamental to advanced concepts. The labs progress from basic pod operations to advanced scheduling and ingress configurations.

🧪 Lab Structure

🔹 Lab 1: Core Kubernetes Objects

  • Concepts: Pods, ReplicaSets, Deployments
  • Key Files:
    • nginx.yaml - Basic nginx pod
    • replica-set-1.yaml - Busybox ReplicaSet
    • deployment-1.yaml - Basic deployment
    • nginx-deployment.yaml - Production deployment
  • Skills Gained:
    • ✅ Imperative vs declarative management
    • ✅ Self-healing capabilities
    • ✅ Deployment strategies
    • ✅ Rollback operations

🔹 Lab 2: Advanced Scheduling

  • Concepts: Namespaces, Resource Management, Node Affinity
  • Key Files:
    • finance-deployment.yaml - Namespaced deployment
    • taint.yaml - Node affinity configuration
  • Skills Gained:
    • ✅ Namespace isolation
    • ✅ Resource quotas
    • ✅ Node selection
    • ✅ Taints/tolerations

🔹 Lab 3: DaemonSets and Services

  • Concepts: DaemonSets, Services, Networking
  • Key Files:
    • fluentd-daemonset.yaml - Cluster logging
    • backend-service.yaml - Service exposure
    • web-app-service.yaml - NodePort service
  • Skills Gained:
    • ✅ Cluster-wide deployments
    • ✅ Service discovery
    • ✅ Internal/external access patterns
    • ✅ Pod networking

🔹 Lab 4: Configurations and Storage

  • Concepts: ConfigMaps, Secrets, PVCs, Multi-container Pods
  • Key Files:
    • darkblue-config.yaml - ConfigMap example
    • db-secret.yaml - Secret management
    • pvc-log.yaml - Persistent storage
    • multi-container-yellow.yaml - Sidecar pattern
  • Skills Gained:
    • ✅ Configuration management
    • ✅ Sensitive data handling
    • ✅ Persistent storage
    • ✅ Pod design patterns

🔹 Lab 5: Ingress Controllers

  • Concepts: Ingress, RBAC, Backend Services
  • Key Files:
    • frontend-deployment.yaml - HAProxy ingress
    • ClusterRole.yaml - RBAC permissions
    • backend-service.yaml - Default backend
  • Skills Gained:
    • ✅ Ingress controller setup
    • ✅ Role-based access control
    • ✅ Default backend configuration
    • ✅ TLS termination

🛠️ Quick Start

# Clone the repository
git clone https://github.com/your-repo/kubernetes-labs.git
cd kubernetes-labs

# Set up cluster (Minikube)
minikube start

# Deploy all lab resources
kubectl apply -f lab1/
kubectl apply -f lab2/
kubectl apply -f lab3/
kubectl apply -f lab4/
kubectl apply -f lab5/

🧰 Common Operations

# Get cluster state
kubectl get all --all-namespaces

# Check specific resources
kubectl get [pods|services|deployments] -n [namespace]

# View detailed info
kubectl describe [resource] [name]

Deployment Management

# Apply configurations
kubectl apply -f [file.yaml]

# Scale deployments
kubectl scale deployment/[name] --replicas=[number]

# Update images
kubectl set image deployment/[name] [container]=[image]

# Rollback changes
kubectl rollout undo deployment/[name]

View pod logs

kubectl logs [pod-name] -c [container]

Debug pod issues

kubectl describe pod [pod-name]

Access services

kubectl port-forward svc/[service-name] [local-port]:[service-port]

📊 Architecture Diagrams Ingress Controller Flow (Lab 5) Internet → NodePort (32456/32567) → HAProxy Ingress → Backend Services → Application Pods

Persistent Storage Flow (Lab 4) Application Pod → PVC → PV → Host Path (/pv/log)

Node Affinity Example (Lab 2) Deployment → Node Selector (color=blue) → Labeled Node

🏆 Best Practices Resource Management:

Always set requests/limits (Lab 2)

Use namespaces for isolation (Lab 2)

Configuration:

Use ConfigMaps for settings (Lab 4)

Store secrets properly (Lab 4)

Availability:

Use multiple replicas (Lab 1)

Implement proper probes (Lab 5)

Security:

Apply least privilege RBAC (Lab 5)

Use network policies

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published