π 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
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 |
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 |
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 |
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 |
-
Clone the Repository:
git clone https://github.com/MiqdadProjects/kodekloud-kubernetes-solutions.git cd kodekloud-kubernetes-solutions
-
Navigate to Task Files:
- Level 1 tasks:
level-1/
- Level 2 tasks:
level-2/
- Level 3 tasks:
level-3/
- Level 4 tasks:
level-4/
- Level 1 tasks:
-
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.
-
Troubleshooting:
- Refer to the "Troubleshooting Common Issues" section in each task file.
- Use commands like
kubectl describe pod
orkubectl logs
for debugging. - Check the
troubleshooting/Common-Issues-Solutions.md
file (TBD) for common fixes.
-
Test in Lab Environment:
- Use the jump host (
ssh thor@jumphost
) with pre-configuredkubectl
. - Verify application accessibility via lab buttons (e.g., "App," "Jenkins," "Grafana").
- Use the jump host (
- 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.
-
Access the Jump Host:
ssh thor@jumphost
-
Create and Edit YAML Files:
vi <task-file>.yaml # Paste YAML content from the taskβs Markdown file # Save with :wq
-
Apply Manifests:
kubectl apply -f <task-file>.yaml
-
Verify Resources:
kubectl get pods kubectl get svc kubectl get deployment kubectl logs <pod-name> curl http://<node-ip>:<node-port>
-
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.
- Use
-
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>
- Check pod status:
- Filenames: Task files use the format
Task-XX-DescriptiveName.md
to avoid VS Code naming issues (e.g., resolved issue withTask-04-Pod-Resource-Limits.md
by usingTask-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.
Contributions are welcome! To add new tasks, improve solutions, or update documentation:
- Fork the repository.
- Create a new branch:
git checkout -b task-XX
- Add or update Markdown/YAML files in the appropriate level directory.
- Commit changes:
git commit -m "Add Task XX solution"
- Push to the branch:
git push origin task-XX
- Open a pull request with a detailed description of changes.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions, issues, or task details, contact the Nautilus DevOps team or open an issue in the repository.
Happy Kuberneting! π