# Kubernetes Deployment Guide Complete guide for deploying Skill Seekers on Kubernetes. ## Table of Contents - [Prerequisites](#prerequisites) - [Quick Start with Helm](#quick-start-with-helm) - [Manual Deployment](#manual-deployment) - [Configuration](#configuration) - [Scaling](#scaling) - [High Availability](#high-availability) - [Monitoring](#monitoring) - [Ingress & Load Balancing](#ingress--load-balancing) - [Storage](#storage) - [Security](#security) - [Troubleshooting](#troubleshooting) ## Prerequisites ### 1. Kubernetes Cluster **Minimum requirements:** - Kubernetes v1.21+ - kubectl configured - 2 nodes (minimum) - 4 CPU cores total - 8 GB RAM total **Cloud providers:** - **AWS:** EKS (Elastic Kubernetes Service) - **GCP:** GKE (Google Kubernetes Engine) - **Azure:** AKS (Azure Kubernetes Service) - **Local:** Minikube, kind, k3s ### 2. Required Tools ```bash # kubectl curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl # Helm 3 curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Verify installations kubectl version --client helm version ``` ### 3. Cluster Access ```bash # Verify cluster connection kubectl cluster-info kubectl get nodes # Create namespace kubectl create namespace skillseekers kubectl config set-context --current --namespace=skillseekers ``` ## Quick Start with Helm ### 1. Install with Default Values ```bash # Add Helm repository (when available) helm repo add skillseekers https://charts.skillseekers.io helm repo update # Install release helm install skillseekers skillseekers/skillseekers \ --namespace skillseekers \ --create-namespace # Or install from local chart helm install skillseekers ./helm/skillseekers \ --namespace skillseekers \ --create-namespace ``` ### 2. Install with Custom Values ```bash # Create values file cat > values-prod.yaml < @type tail path /var/log/containers/skillseekers*.log pos_file /var/log/fluentd-skillseekers.pos tag kubernetes.* format json @type elasticsearch host elasticsearch port 9200 ``` ## Ingress & Load Balancing ### 1. Nginx Ingress ```yaml # ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: skillseekers namespace: skillseekers annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/rate-limit: "100" nginx.ingress.kubernetes.io/ssl-redirect: "true" spec: tls: - hosts: - api.skillseekers.example.com secretName: skillseekers-tls rules: - host: api.skillseekers.example.com http: paths: - path: / pathType: Prefix backend: service: name: skillseekers-mcp port: number: 8765 ``` ### 2. TLS with cert-manager ```bash # Install cert-manager kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml # Create ClusterIssuer cat < -n skillseekers # Check events kubectl get events -n skillseekers --sort-by='.lastTimestamp' # Check logs kubectl logs -n skillseekers ``` #### 2. Image Pull Errors ```bash # Check image pull secrets kubectl get secrets -n skillseekers # Create image pull secret kubectl create secret docker-registry regcred \ --docker-server=registry.example.com \ --docker-username=user \ --docker-password=password \ -n skillseekers # Use in pod spec spec: imagePullSecrets: - name: regcred ``` #### 3. Resource Constraints ```bash # Check node resources kubectl top nodes # Check pod resources kubectl top pods -n skillseekers # Increase resources kubectl edit deployment skillseekers-mcp -n skillseekers ``` #### 4. Service Not Accessible ```bash # Check service kubectl get svc -n skillseekers kubectl describe svc skillseekers-mcp -n skillseekers # Check endpoints kubectl get endpoints -n skillseekers # Port forward kubectl port-forward svc/skillseekers-mcp 8765:8765 -n skillseekers ``` ### Debug Commands ```bash # Execute command in pod kubectl exec -it -n skillseekers -- /bin/bash # Copy files from pod kubectl cp skillseekers/:/app/data ./data # Check pod networking kubectl exec -n skillseekers -- nslookup google.com # View full pod spec kubectl get pod -n skillseekers -o yaml # Restart deployment kubectl rollout restart deployment skillseekers-mcp -n skillseekers ``` ## Best Practices 1. **Always set resource requests and limits** 2. **Use namespaces for environment separation** 3. **Enable autoscaling for variable workloads** 4. **Implement health checks (liveness & readiness)** 5. **Use Secrets for sensitive data** 6. **Enable monitoring and logging** 7. **Implement Pod Disruption Budgets for HA** 8. **Use RBAC for access control** 9. **Enable Network Policies** 10. **Regular backup of persistent volumes** ## Next Steps - Review [PRODUCTION_DEPLOYMENT.md](./PRODUCTION_DEPLOYMENT.md) for general guidelines - See [DOCKER_DEPLOYMENT.md](./DOCKER_DEPLOYMENT.md) for container-specific details - Check [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) for common issues --- **Need help?** Open an issue on [GitHub](https://github.com/yusufkaraaslan/Skill_Seekers/issues).