1
0
forked from DRAM-IT/Wiki
Wiki-By-Syukri/test.md

148 lines
4.7 KiB
Markdown
Raw Normal View History

2025-05-28 03:26:58 +00:00
** test **
2025-05-28 03:36:58 +00:00
### **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**:
1. Install Jenkins on a local VM/cloud instance.
2. Create a "Hello World" pipeline script (declarative syntax).
3. Trigger a build on a Git commit (webhook setup).
```groovy
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**:
1. Set up a local Kubernetes cluster (Minikube/kind).
2. Configure Jenkins to deploy to Kubernetes:
- Install Kubernetes plugin.
- Add Kubeconfig to Jenkins credentials.
3. Create a pipeline to build a Docker image and deploy to Kubernetes:
```groovy
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**:
1. Declare a Kubernetes deployment manifest in a Git repo.
2. Use Jenkins to sync the cluster state with the Git repo:
- Poll Git for changes.
- Automatically run `kubectl apply` on updates.
---
#### **5. Jenkins + GitOps Lab (2:30 PM 4:00 PM)**
**Objective**: Automate Kubernetes deployments using GitOps with Jenkins.
- **Lab Steps**:
1. Fork a sample Git repo with Kubernetes manifests.
2. Configure Jenkins to monitor the repo (SCM polling).
3. Create a pipeline to apply changes:
```groovy
pipeline {
agent any
stages {
stage('Sync K8s') {
steps {
git url: 'https://github.com/your-repo.git', branch: 'main'
sh 'kubectl apply -f ./manifests/'
}
}
}
}
```
4. 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.