Jenkins en EKS con EFS

Guía para desplegar Jenkins en Amazon EKS con almacenamiento persistente mediante AWS EFS y CSI driver, ideal para CI/CD en la nube.

28 sept 2025 • 4 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

En esta guía explicamos cómo desplegar Jenkins en Amazon EKS con almacenamiento persistente basado en AWS EFS y gestionado por el driver CSI. Esta arquitectura proporciona un volumen compartido, escalable y duradero para los builds y agentes de Jenkins, ideal para entornos CI CD en la nube.

Paso 1 Instalar AWS EFS CSI Driver

kubectl apply -k github.com/kubernetes-sigs/aws-efs-csi-driver/deploy/kubernetes/overlays/stable/?ref=master

Paso 2 Preparar recursos en AWS

Obtener VPC ID aws eks describe-cluster --name hulk-santhosh-cluster --query cluster.resourcesVpcConfig.vpcId --output text --region ap-south-1

Obtener rango CIDR de la VPC aws ec2 describe-vpcs --vpc-ids vpc-07937adc3227e4b54 --query Vpcs[].CidrBlock --output text --region ap-south-1

Crear Security Group aws ec2 create-security-group --description efs-test-sg --group-name efs-sg --vpc-id vpc-07937adc3227e4b54 --region ap-south-1

Autorizar ingreso para NFS aws ec2 authorize-security-group-ingress --group-id sg-0be281b6c437376c5 --protocol tcp --port 2049 --cidr 192.168.0.0/16

Paso 3 Crear sistema de ficheros EFS y mount target

Crear EFS aws efs create-file-system --creation-token eks-efs --region ap-south-1

Crear mount target aws efs create-mount-target --file-system-id fs-04ec113cee81e30b2 --subnet-id subnet-0a6d27e06ff1e24ed --security-group sg-0be281b6c437376c5

Paso 4 Configuración de almacenamiento en Kubernetes

PersistentVolume ejemplo

apiVersion v1kind PersistentVolumemetadata name jenkinsspec capacity storage 5GivolumeMode FilesystemaccessModes - ReadWriteManypersistentVolumeReclaimPolicy RetainstorageClassName efs-sccsi driver efs.csi.aws.com volumeHandle fs-04ec113cee81e30b2

PersistentVolumeClaim ejemplo

apiVersion v1kind PersistentVolumeClaimmetadata name jenkins-claimspec accessModes - ReadWriteManystorageClassName efs-scresources requests storage 5Gi

Paso 5 RBAC para Jenkins

ServiceAccount ejemplo apiVersion v1 kind ServiceAccount metadata name jenkins

ClusterRole ejemplo apiVersion rbac.authorization.k8s.io/v1 kind ClusterRole metadata name jenkins rules Agregar las reglas necesarias para que Jenkins pueda crear pods y gestionar recursos

RoleBinding ejemplo apiVersion rbac.authorization.k8s.io/v1 kind RoleBinding metadata name jenkins roleRef apiGroup rbac.authorization.k8s.io kind ClusterRole name jenkins subjects - kind ServiceAccount name jenkins namespace jenkins

Paso 6 Servicio de Jenkins

apiVersion v1 kind Service metadata name jenkins labels app jenkins spec type ClusterIP ports - name ui port 8080 targetPort 8080 - name slave port 50000 - name http port 80 targetPort 8080 selector app jenkins

Paso 7 Deployment de Jenkins

apiVersion apps/v1 kind Deployment metadata name jenkins namespace jenkins labels app jenkins spec replicas 1 selector matchLabels app jenkins template metadata labels app jenkins spec securityContext fsGroup 1000 initContainers - name volume-permission-fix image busybox command [sh,-c,chown -R 1000:1000 /var/jenkins_home] securityContext runAsUser 0 volumeMounts - name jenkins-home mountPath /var/jenkins_home containers - name jenkins image jenkins/jenkins:lts ports - containerPort 8080 - containerPort 50000 volumeMounts - name jenkins-home mountPath /var/jenkins_home volumes - name jenkins-home persistentVolumeClaim claimName jenkins-claim

Paso 8 Obtener contraseña inicial de Jenkins

kubectl exec -it <jenkins-pod-name> -n jenkins -- cat /var/jenkins_home/secrets/initialAdminPassword

Paso 9 Token de Service Account

Secret ejemplo apiVersion v1 kind Secret metadata name jenkins-token namespace jenkins annotations kubernetes.io/service-account.name jenkins type kubernetes.io/service-account-token

Paso 10 Configurar la nube Kubernetes en Jenkins

Kubernetes URL https://kubernetes.default.svc.cluster.localNamespace jenkinsCredentials Token de la Service Account creado anteriormenteJenkins URL https://jenkins.jenkins.svc.cluster.local:8080Jenkins Tunnel jenkins.jenkins.svc.cluster.local:50000

Al probar la conexión debe aparecer Connected to Kubernetes

Plantilla de pod para agentes de Jenkins

Nombre jenkins-agent Namespace jenkins Labels jenkins-agent Usage Only build jobs with matching labelContainer Template Name jnlp Image jenkins/inbound-agent:latest Working Dir /home/jenkins/agent Allocate pseudo-TTY true

Recomendaciones y buenas prácticas

1 Mantener el EFS en la misma región y subredes que su cluster EKS para reducir latencia.2 Usar security groups y reglas de NFS mínimas necesarias para mayor seguridad.3 Versionar y parametrizar manifiestos Kubernetes para despliegues reproducibles.4 Monitorizar rendimiento y costes de EFS en entornos con alto IOPS.

Sobre Q2BSTUDIO

Q2BSTUDIO es una empresa de desarrollo de software especializada en aplicaciones a medida y software a medida, con capacidades en inteligencia artificial, ciberseguridad y servicios cloud AWS y Azure. Ofrecemos soluciones integrales que incluyen desarrollo de backends y frontends, integración de pipelines CI CD como la descrita en esta guía, deployments en EKS y almacenamiento persistente con EFS. Si necesita despliegues cloud gestionados o migración a AWS o Azure consulte nuestros servicios en Servicios cloud AWS y Azure.

También desarrollamos soluciones de inteligencia artificial para empresas, agentes IA y proyectos de analítica avanzada y Power BI que ayudan a convertir datos en decisiones. Conozca nuestras propuestas en servicios de inteligencia artificial. Además ofrecemos servicios de ciberseguridad y pentesting, inteligencia de negocio y automatización de procesos para impulsar la eficiencia y la seguridad en sus proyectos.

Palabras clave relacionadas aplicaciones a medida software a medida inteligencia artificial ciberseguridad servicios cloud aws y azure servicios inteligencia de negocio ia para empresas agentes IA power bi

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat