This repository contains the configuration files to deploy a Jenkins master as a Kubernetes StatefulSet with an integrated Horizontal Pod Autoscaler (HPA).
This configuration deploys a Jenkins master node using the following Kubernetes resources:
- StatefulSet: Ensures consistent pod identity and persistent storage for Jenkins data.
- Horizontal Pod Autoscaler (HPA): Monitors CPU utilization and adjusts the number of replicas accordingly.
- A Kubernetes cluster with
kubectl
configured. - A PersistentVolumeClaim (PVC) named
jenkins-home
to store Jenkins data. - A service account named
jenkins-service-account
with the necessary permissions.
- Name:
jenkins-standalone-statefulset
- Service Name:
jenkins-service
- Image:
jenkins/jenkins:lts
- Replicas: 1
- Volume: Persistent storage mounted at
/var/jenkins_home
.
- Liveness Probe: Ensures the Jenkins master pod is running.
- Readiness Probe: Ensures the pod is ready to serve traffic.
- Requests: 512Mi memory, 500m CPU
- Limits: 1Gi memory, 1 CPU
- fsGroup: 1000
- runAsUser: 1000
- Name:
jenkins-hpa
- Target Resource: The Jenkins StatefulSet.
- Minimum replicas: 1
- Maximum replicas: 1 (can be increased based on workload requirements).
- Target CPU Utilization: 80%
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkins-home
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi