본문 바로가기
Jenkins

Jenkins Deployment로 설치하기

by aws-evan 2024. 6. 13.
728x90

 

Kubernetes에 Jenkins 설치 

간단한 테스트를 위한 환경이기에 PV 경로는 hostPath로 진행하며, NFS, SC를 사용해도 상관없습니다.

 

 

  • Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins
  namespace: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      containers:
      - name: jenkins
        image: jenkins/jenkins:lts
        ports:
        - containerPort: 8080
          name: http
        volumeMounts:
        - name: jenkins-storage
          mountPath: /var/jenkins_home
      volumes:
      - name: jenkins-storage
        persistentVolumeClaim:
          claimName: jenkins-pvc

 

 

 

  • Service
apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: jenkins
spec:
  type: NodePort
  selector:
    app: jenkins
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 30000
      name: http

 

  • Volume(PV,PVC)
# pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: jenkins-pv
  namespace: jenkins
spec:
  capacity:
    storage: 50Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data/jenkins"
---
# pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jenkins-pvc
  namespace: jenkins
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi

 

 

 

 

 

  • 접속

728x90

'Jenkins' 카테고리의 다른 글

Jenkins Pipeline CICD 테스트  (3) 2024.03.18
[Jenkins]JVM 용량 증설하기  (0) 2022.06.22
[Docker]Docker로 Jenkins 설치  (0) 2022.03.05

댓글