Skip to content

Complete solutions and documentation for KodeKloud Engineer kubernetes tasks. Each task includes problem analysis, solution implementation, and detailed explanations with best practices.

License

Notifications You must be signed in to change notification settings

MiqdadProjects/kodekloud-kubernetes-solutions

🌟 KodeKloud Kubernetes Solutions

πŸ“Œ Project Overview

This repository contains solutions for Kubernetes lab tasks from KodeKloud, organized by difficulty levels (Level 1 to Level 4). Each task is documented in a detailed Markdown file with step-by-step instructions, YAML manifests, verification commands, troubleshooting tips, and production notes. These solutions are designed to assist the Nautilus DevOps team in deploying and managing Kubernetes resources efficiently. It is important to note that when starting any Kubernetes task, users are already logged into the Jump Host by default as the thor user. Therefore, the SSH command to connect again is for educational purposes. This repository serves as a comprehensive record of my learning experience through the KodeKloud Engineer challenge, showcasing real-world tasks and projects designed to build practical DevOps Kubernetes expertise. The tasks documented here reflect the specific challenges I encountered during the challenge, including detailed solutions and verification steps. Note: While the core objectives and challenges remain consistent, the specific values (e.g., server names, file paths, or other parameters) in these tasks may differ from those you encounter in your own environment. However, the underlying concepts and problem-solving approaches remain applicable, enabling you to adapt the solutions to your specific context.

πŸ” Purpose: Provide clear, executable solutions for Kubernetes labs, ensuring best practices and alignment with task requirements.

πŸ› οΈ Tools Used:

  • Kubernetes: Managed via kubectl on the jump host.
  • Images: Official images (e.g., nginx:latest, debian:latest, jenkins/jenkins).
  • Environment: KodeKloud lab environment with pre-configured kubectl.

πŸ“‚ Repository Structure:

kodekloud-kubernetes-solutions/
β”œβ”€β”€ level-1/
β”‚   β”œβ”€β”€ Task-01-VolumeShareDevops.md
β”‚   β”œβ”€β”€ Task-02-WebserverPod.md
β”‚   β”œβ”€β”€ Task-03-NginxDeployment.md
β”‚   β”œβ”€β”€ Task-04-PodResourceLimits.md
β”‚   β”œβ”€β”€ Task-05-HttpdDeploymentRollback.md
β”‚   β”œβ”€β”€ Task-06-JenkinsDeployment.md
β”‚   β”œβ”€β”€ Task-07-GrafanaDeployment.md
β”‚   β”œβ”€β”€ Task-08-TomcatDeployment.md
β”‚   β”œβ”€β”€ Task-09-NodeDeployment.md
β”‚   β”œβ”€β”€ Task-10-TimeCheckPod.md
β”‚   β”œβ”€β”€ Task-11-SidecarFix.md
β”‚   β”œβ”€β”€ Task-12-UpdateDeploymentService.md
β”‚   β”œβ”€β”€ Task-13-ReplicationController.md
β”‚   β”œβ”€β”€ Task-14-NginxPHPFPMFix.md
β”œβ”€β”€ level-2/
β”‚   β”œβ”€β”€ Task-01-VolumeShareDevops.md
β”‚   β”œβ”€β”€ Task-02-WebserverPod.md
β”‚   β”œβ”€β”€ Task-03-NginxDeployment.md
β”‚   β”œβ”€β”€ Task-04-PrintEnvarsGreeting.md
β”‚   β”œβ”€β”€ Task-05-HttpdDeploymentRollback.md
β”‚   β”œβ”€β”€ Task-06-JenkinsDeployment.md
β”‚   β”œβ”€β”€ Task-07-GrafanaDeployment.md
β”‚   β”œβ”€β”€ Task-08-TomcatDeployment.md
β”‚   β”œβ”€β”€ Task-09-NodeDeployment.md
β”‚   β”œβ”€β”€ Task-10-TroubleshootDeployment.md
β”‚   β”œβ”€β”€ Task-11-LAMPEnvironmentFix.md
β”œβ”€β”€ level-3/
β”‚   β”œβ”€β”€ Task-01-PythonAppFix.md
β”‚   β”œβ”€β”€ Task-02-LAMPStackDeployment.md
β”‚   β”œβ”€β”€ Task-03-InitContainers.md
β”‚   β”œβ”€β”€ Task-04-PersistentVolumes.md
β”‚   β”œβ”€β”€ Task-05-ManageSecrets.md
β”‚   β”œβ”€β”€ Task-06-EnvironmentVariables.md
β”‚   β”œβ”€β”€ Task-07-LEMPSetup.md
β”‚   β”œβ”€β”€ Task-08-KubernetesTroubleshooting.md
β”‚   β”œβ”€β”€ Task-09-IronGalleryDeployment.md
β”‚   β”œβ”€β”€ Task-10-PythonAppFix.md
β”œβ”€β”€ level-4/
β”‚   β”œβ”€β”€ Task-01-RedisDeployment.md
β”‚   β”œβ”€β”€ Task-02-MySQLDeployment.md
β”‚   β”œβ”€β”€ Task-03-NginxPHPFPMSetup.md
β”‚   β”œβ”€β”€ Task-04-DrupalAppDeployment.md
β”‚   β”œβ”€β”€ Task-05-GuestBookAppDeployment.md
β”œβ”€β”€ commands-reference/
β”‚   └── Kubernetes-Commands-Cheatsheet.md 
β”œβ”€β”€ troubleshooting/
β”‚   └── Common-Issues-Solutions.md 
└── README.md

πŸš€ Level 1 Tasks

Task # Title/Link Status Difficulty Description
1 Volume Share Devops βœ… Done 🟒 Basic Create a pod with shared volume between two containers
2 Webserver Pod βœ… Done 🟒 Basic Create a pod with nginx and sidecar logging container
3 Nginx Deployment βœ… Done 🟑 Intermediate Deploy nginx with 3 replicas and NodePort service
4 Pod with Resource Limits βœ… Done 🟑 Intermediate Set CPU and memory limits for an httpd pod
5 Httpd Deployment Rollback βœ… Done 🟑 Intermediate Deploy httpd, update, and rollback with NodePort service
6 Jenkins Deployment βœ… Done 🟑 Intermediate Deploy Jenkins with NodePort service
7 Grafana Deployment βœ… Done 🟑 Intermediate Deploy Grafana with NodePort service
8 Tomcat Deployment βœ… Done 🟑 Intermediate Deploy Tomcat with NodePort service
9 Node Deployment βœ… Done 🟑 Intermediate Deploy Node app with 2 replicas and NodePort service
10 Time Check Pod βœ… Done 🟒 Basic Create a pod to display time every 10 seconds
11 Sidecar Fix βœ… Done 🟑 Intermediate Fix a sidecar container logging issue
12 Update Deployment Service βœ… Done 🟑 Intermediate Update deployment and service for an application
13 Replication Controller βœ… Done 🟑 Intermediate Create a replication controller for an application
14 Nginx PHP-FPM Fix βœ… Done 🟑 Intermediate Fix an Nginx and PHP-FPM application deployment

πŸš€ Level 2 Tasks

Task # Title/Link Status Difficulty Description
1 Volume Share Devops βœ… Done 🟒 Basic Create a pod with shared volume between two containers
2 Webserver Pod βœ… Done 🟒 Basic Create a pod with nginx and sidecar logging container
3 Nginx Deployment βœ… Done 🟑 Intermediate Deploy nginx with 3 replicas and NodePort service
4 Print Envars Greeting βœ… Done 🟒 Basic Create a pod with environment variables and echo command
5 Httpd Deployment Rollback βœ… Done 🟑 Intermediate Deploy httpd, update, and rollback with NodePort service
6 Jenkins Deployment βœ… Done 🟑 Intermediate Deploy Jenkins with NodePort service
7 Grafana Deployment βœ… Done 🟑 Intermediate Deploy Grafana with NodePort service
8 Tomcat Deployment βœ… Done 🟑 Intermediate Deploy Tomcat with NodePort service
9 Node Deployment βœ… Done 🟑 Intermediate Deploy Node app with 2 replicas and NodePort service
10 Troubleshoot Deployment βœ… Done 🟑 Intermediate Fix issues in a Kubernetes deployment
11 LAMP Environment Fix βœ… Done 🟑 Intermediate Fix issues in a LAMP stack deployment

πŸš€ Level 3 Tasks

Task # Title/Link Status Difficulty Description
1 Python App Fix βœ… Done 🟑 Intermediate Fix a misconfigured Python application deployment
2 LAMP Stack Deployment βœ… Done 🟑 Intermediate Deploy a LAMP stack with persistent storage
3 Init Containers βœ… Done 🟑 Intermediate Configure init containers for pod initialization
4 Persistent Volumes βœ… Done 🟑 Intermediate Configure persistent volumes for storage
5 Manage Secrets βœ… Done 🟑 Intermediate Manage Kubernetes secrets for secure configuration
6 Environment Variables βœ… Done 🟒 Basic Configure environment variables for pods
7 LEMP Setup βœ… Done 🟑 Intermediate Deploy an LEMP stack with Nginx and PHP
8 Kubernetes Troubleshooting βœ… Done 🟑 Intermediate Troubleshoot and resolve Kubernetes issues
9 Iron Gallery Deployment βœ… Done 🟑 Intermediate Deploy Iron Gallery app with database
10 Python App Fix βœ… Done 🟑 Intermediate Fix another misconfigured Python application deployment

πŸš€ Level 4 Tasks

Task # Title/Link Status Difficulty Description
1 Redis Deployment βœ… Done 🟠 Advanced Deploy Redis master and slave with services
2 MySQL Deployment βœ… Done 🟠 Advanced Deploy MySQL with persistent storage and service
3 Nginx PHP-FPM Setup βœ… Done 🟠 Advanced Deploy Nginx and PHP-FPM with custom configuration
4 Drupal App Deployment βœ… Done 🟠 Advanced Deploy Drupal with MySQL and persistent storage
5 Guest Book App Deployment βœ… Done 🟠 Advanced Deploy guestbook app with Redis backend and frontend

πŸ’‘ How to Use This Repository

  1. Clone the Repository:

    git clone https://github.com/MiqdadProjects/kodekloud-kubernetes-solutions.git
    cd kodekloud-kubernetes-solutions
  2. Navigate to Task Files:

    • Level 1 tasks: level-1/
    • Level 2 tasks: level-2/
    • Level 3 tasks: level-3/
    • Level 4 tasks: level-4/
  3. Apply Solutions:

    • Copy the YAML manifests from each task’s Markdown file.
    • Run kubectl apply -f <file>.yaml to deploy resources.
    • Follow verification steps (e.g., kubectl get pods, kubectl logs) to ensure success.
  4. Troubleshooting:

    • Refer to the "Troubleshooting Common Issues" section in each task file.
    • Use commands like kubectl describe pod or kubectl logs for debugging.
    • Check the troubleshooting/Common-Issues-Solutions.md file (TBD) for common fixes.
  5. Test in Lab Environment:

    • Use the jump host (ssh thor@jumphost) with pre-configured kubectl.
    • Verify application accessibility via lab buttons (e.g., "App," "Jenkins," "Grafana").

πŸ”§ Prerequisites

  • Kubernetes Cluster: Access to a Kubernetes cluster via kubectl on the jump host.
  • Text Editor: VS Code or similar for editing Markdown and YAML files.
  • Git: For version control and repository management.
  • Lab Environment: KodeKloud lab with pre-configured jump host.

πŸ“‹ Detailed Setup Guide

  1. Access the Jump Host:

    ssh thor@jumphost
  2. Create and Edit YAML Files:

    vi <task-file>.yaml
    # Paste YAML content from the task’s Markdown file
    # Save with :wq
  3. Apply Manifests:

    kubectl apply -f <task-file>.yaml
  4. Verify Resources:

    kubectl get pods
    kubectl get svc
    kubectl get deployment
    kubectl logs <pod-name>
    curl http://<node-ip>:<node-port>
  5. Test Application Access:

    • Use curl or the lab’s UI buttons (e.g., "App," "NodeApp") to verify accessibility.
    • Example: For Task 3 (Level 4), click the "App" button to check Nginx PHP-FPM on port 30012.
  6. Debug Issues:

    • Check pod status: kubectl describe pod <pod-name>
    • View logs: kubectl logs <pod-name> -c <container-name>
    • Verify services: kubectl describe svc <service-name>

⚠️ Important Notes

  • Filenames: Task files use the format Task-XX-DescriptiveName.md to avoid VS Code naming issues (e.g., resolved issue with Task-04-Pod-Resource-Limits.md by using Task-04-PodResourceLimits.md).
  • Image Tags: Always use specified image tags (e.g., nginx:latest, httpd:2.4.27) to meet task requirements.
  • Dry Runs: Test manifests with kubectl apply -f <file>.yaml --dry-run=client to validate syntax.
  • Production Readiness: Each task includes production notes for real-world considerations.
  • Level Completion: All tasks in Levels 1, 2, 3, and 4 are complete.

πŸš€ Contributing

Contributions are welcome! To add new tasks, improve solutions, or update documentation:

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b task-XX
  3. Add or update Markdown/YAML files in the appropriate level directory.
  4. Commit changes:
    git commit -m "Add Task XX solution"
  5. Push to the branch:
    git push origin task-XX
  6. Open a pull request with a detailed description of changes.

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.


πŸ“ž Contact

For questions, issues, or task details, contact the Nautilus DevOps team or open an issue in the repository.

Happy Kuberneting! πŸš€

About

Complete solutions and documentation for KodeKloud Engineer kubernetes tasks. Each task includes problem analysis, solution implementation, and detailed explanations with best practices.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •