forked from DRAM-IT/Wiki
4.7 KiB
4.7 KiB
** test **
1-Day Learning & Lab Activity Plan for IT Engineer: CI/CD, Jenkins, Kubernetes, GitOps
Focus Areas: CI/CD Concepts, Jenkins, Kubernetes Integration, GitOps Principles
Morning Session (9:00 AM – 12:30 PM)
1. Introduction to CI/CD Concepts (9:00 AM – 9:45 AM)
Objective: Understand core CI/CD principles and workflows.
- Key Topics:
- What is CI/CD? Benefits (speed, reliability, automation).
- CI/CD pipeline stages: Build → Test → Deploy → Monitor.
- Differences between traditional deployment vs. CI/CD.
- Tools overview (Jenkins, GitLab CI, GitHub Actions).
- Activity: Whiteboard a sample CI/CD pipeline for a web app.
2. Jenkins for CI/CD (9:45 AM – 11:00 AM)
Objective: Set up Jenkins and create a basic CI/CD pipeline.
- Key Topics:
- Jenkins architecture (master/agent, plugins).
- Creating freestyle and pipeline jobs.
- Integrating Jenkins with Git (GitHub/GitLab).
- Lab Activity:
- Install Jenkins on a local VM/cloud instance.
- Create a "Hello World" pipeline script (declarative syntax).
- Trigger a build on a Git commit (webhook setup).
pipeline { agent any stages { stage('Build') { steps { echo 'Building...' } } stage('Test') { steps { echo 'Testing...' } } } } - Troubleshooting: Resolving plugin conflicts, agent connectivity.
Break (11:00 AM – 11:15 AM)
3. Jenkins CI/CD for Kubernetes (11:15 AM – 12:30 PM)
Objective: Deploy applications to Kubernetes using Jenkins.
- Key Topics:
- Kubernetes basics (pods, deployments, services).
- Jenkins plugins for Kubernetes (Kubernetes CLI, Helm).
- Dynamic Jenkins agents in Kubernetes pods.
- Lab Activity:
- Set up a local Kubernetes cluster (Minikube/kind).
- Configure Jenkins to deploy to Kubernetes:
- Install Kubernetes plugin.
- Add Kubeconfig to Jenkins credentials.
- Create a pipeline to build a Docker image and deploy to Kubernetes:
pipeline { agent any stages { stage('Build Docker') { steps { sh 'docker build -t my-app:latest .' } } stage('Deploy to K8s') { steps { sh 'kubectl apply -f k8s-deployment.yaml' } } } } - Challenge: Diagnose a failed deployment (e.g., image pull error).
Lunch Break (12:30 PM – 1:30 PM)
Afternoon Session (1:30 PM – 5:00 PM)
4. GitOps Principles (1:30 PM – 2:30 PM)
Objective: Learn GitOps fundamentals and declarative infrastructure.
- Key Topics:
- What is GitOps? (Git as the single source of truth).
- Declarative vs. imperative infrastructure.
- Tools: Argo CD, Flux, Jenkins GitOps integration.
- Activity: Compare CI/CD and GitOps workflows.
- Lab Activity:
- Declare a Kubernetes deployment manifest in a Git repo.
- Use Jenkins to sync the cluster state with the Git repo:
- Poll Git for changes.
- Automatically run
kubectl applyon updates.
5. Jenkins + GitOps Lab (2:30 PM – 4:00 PM)
Objective: Automate Kubernetes deployments using GitOps with Jenkins.
- Lab Steps:
- Fork a sample Git repo with Kubernetes manifests.
- Configure Jenkins to monitor the repo (SCM polling).
- Create a pipeline to apply changes:
pipeline { agent any stages { stage('Sync K8s') { steps { git url: 'https://github.com/your-repo.git', branch: 'main' sh 'kubectl apply -f ./manifests/' } } } }- Modify a manifest in Git and observe Jenkins auto-deploying.
- Discussion: Security considerations (secrets management, RBAC).
Break (4:00 PM – 4:15 PM)
6. Recap, Q&A, and Feedback (4:15 PM – 5:00 PM)
- Review key takeaways: CI/CD pipelines, Jenkins-Kubernetes integration, GitOps.
- Q&A: Common pitfalls (e.g., pipeline debugging, state drift in GitOps).
- Feedback Session: Adjust future content based on learner input.
- Additional Resources:
- Jenkins Documentation: https://www.jenkins.io/doc/
- GitOps Working Group: https://www.gitops.tech/
Lab Environment Setup (Pre-requisites)
- Jenkins server with Docker, Kubernetes plugins.
- Kubernetes cluster (Minikube, EKS, or GKE).
- Git repository (GitHub/GitLab) with sample code and manifests.
By the end of the day, learners will have built a Jenkins pipeline for Kubernetes deployments and implemented GitOps practices for infrastructure management.