[Helm] Jenkins

[Helm] Jenkins

EBS 생성

Jenkins의 데이터를 저장할 볼륨을 생성하는 과정으로 Jenkins가 설치될 노드가 생성되는 영역과 일치 시켜줘야 pod 생성 시 볼륨이 연결된다. EBS는 단일 노드에서만 사용할 수 있어 멀티 노드에서 볼륨을 공유하여 사용할 시 EFS나 NFS를 고려해봐야한다.

export VOLUME_ID=$(aws ec2 create-volume --size 20 \ --region ap-northeast-2 \ --availability-zone ap-northeast-2a \ --volume-type gp2 \ --tag-specifications 'ResourceType=volume, Tags=[{Key=Name,Value=EKS-Jenkins}]' \ | jq '.VolumeId' -r)

Jenkins Chart 다운로드 및 네임스페이스 생성

helm repo add jenkinsci https://charts.jenkins.io helm repo update helm pull jenkinsci/jenkins --untar kubectl create namespace jenkins

Jenkins Chart 수정

PV 생성

jenkins/template/jenkins-pv.yaml apiVersion: v1 kind: PersistentVolume metadata: name: jenkins-pv namespace: jenkins spec: storageClassName: jenkins-pv accessModes: - ReadWriteOnce capacity: storage: 20Gi persistentVolumeReclaimPolicy: Retain awsElasticBlockStore: volumeID: 생성된 볼륨 ID

기타 설정

48 : 계정 비밀번호 설정

95 : Prefix 설정(/jenkins 주소 사용)

122, 127 : 서비스타입 변경(NLB)

160, 170 : 상태체크 시작 시간 수정

387 : 생성 노드 그룹 지정

752 : PVC와 매칭될 PV 이름지정

756 : 볼륨 크기 지정

jenkins/values.yaml 46 # you should revert controller.adminUser to your preferred admin user: 47 adminUser: "admin" 48 adminPassword: "비밀번호" 94 # If you set this prefix and use ingress controller then you might want to set the ingress path below 95 jenkinsUriPrefix: "/jenkins" 120 # For minikube, set this to NodePort, elsewhere use LoadBalancer 121 # Use ClusterIP if your setup includes ingress controller 122 serviceType: LoadBalancer 123 # Use Local to preserve the client source IP and avoids a second hop for LoadBalancer and Nodeport type services, 124 # but risks potentially imbalanced traffic spreading. 125 serviceExternalTrafficPolicy: 126 # Jenkins controller service annotations 127 serviceAnnotations: {service.beta.kubernetes.io/aws-load-balancer-type: "nlb"} 158 # If Startup Probe is not supported on your Kubernetes cluster, you might want to use "initialDelaySeconds" instead. 159 # It delays the initial liveness probe while Jenkins is starting 160 initialDelaySeconds: 60 168 # If Startup Probe is not supported on your Kubernetes cluster, you might want to use "initialDelaySeconds" instead. 169 # It delays the initial readyness probe while Jenkins is starting 170 initialDelaySeconds: 60 387 nodeSelector: {alpha.eksctl.io/nodegroup-name: mng-ng} 389 terminationGracePeriodSeconds: 391 terminationMessagePath: 392 terminationMessagePolicy: 752 storageClass: jenkins-pv 753 annotations: {} 754 labels: {} 755 accessMode: "ReadWriteOnce" 756 size: "20Gi" 757 volumes: 758 # - name: nothing 759 # emptyDir: {} 760 mounts: 761 # - mountPath: /var/nothing 762 # name: nothing 763 # readOnly: true

설치 및 삭제

helm upgrade --install jenkins -n jenkins -f ./values.yaml ./

helm uninstall jenkins -n jenkins

from http://ekwkqk12.tistory.com/36 by ccl(A) rewrite - 2021-09-26 23:00:41