Jenkins Helm Install > Jenkins 자료실

본문 바로가기
사이트 내 전체검색

Jenkins 자료실

Jenkins Helm Install

페이지 정보

profile_image
작성자 조선제일검
댓글 0건 조회 422회 작성일 23-11-02 09:15

본문

Helm Repository 젠킨스 추가 및 Repo 확인 후 업데이트
---------------------------------------------------------------------------------------------------------------------------------------
devops@connect-vm-devops:~/package_helm$ helm repo add jenkins https://charts.jenkins.io
"jenkins" has been added to your repositories

devops@connect-vm-devops:~/package_helm$ helm repo list
NAME            URL
argocd          https://argoproj.github.io/argo-helm
gitlab          https://charts.gitlab.io/
ingress-nginx  https://kubernetes.github.io/ingress-nginx
harbor          https://helm.goharbor.io
jenkins        https://charts.jenkins.io

devops@connect-vm-devops:~/package_helm$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "harbor" chart repository
...Successfully got an update from the "argocd" chart repository
...Successfully got an update from the "jenkins" chart repository
...Successfully got an update from the "gitlab" chart repository
Update Complete. ⎈Happy Helming!⎈
---------------------------------------------------------------------------------------------------------------------------------------



Jenkins Pull Download 및 압축해제
---------------------------------------------------------------------------------------------------------------------------------------
devops@connect-vm-devops:~/package_helm$ helm pull jenkins/jenkins

devops@connect-vm-devops:~/package_helm$ ls -al jenkins-4.1.8.tgz
-rw-r--r-- 1 devops devops 67279 Jun 16 05:44 jenkins-4.1.8.tgz
---------------------------------------------------------------------------------------------------------------------------------------



Jenkins를 K8S에 올리기 Service Account라는 설정이 필요한데 이를 위해서는 jenkins-sa.yaml 파일이 필요합니다.
또한 영구볼륨 설정이 필요할 시 영구볼륨 설정파일(jenkins-volume.yaml)을 다운로드받습니다.
---------------------------------------------------------------------------------------------------------------------------------------
wget https://raw.githubusercontent.com/jenkins-infra/jenkins.io/master/content/doc/tutorials/kubernetes/installing-jenkins-on-kubernetes/jenkins-sa.yaml
---------------------------------------------------------------------------------------------------------------------------------------



Jenkins 데이터 손실방지를 위한 영구볼륨 파일설정입니다.
---------------------------------------------------------------------------------------------------------------------------------------
wget https://raw.githubusercontent.com/jenkins-infra/jenkins.io/master/content/doc/tutorials/kubernetes/installing-jenkins-on-kubernetes/jenkins-volume.yaml
---------------------------------------------------------------------------------------------------------------------------------------



YAML 커스텀 설정
---------------------------------------------------------------------------------------------------------------------------------------
# values.yaml

127  # For minikube, set this to NodePort, elsewhere use LoadBalancer
128  # Use ClusterIP if your setup includes ingress controller
129  serviceType: LoadBalancer
...
761 persistence:
762  enabled: true
763  ## A manually managed Persistent Volume and Claim
764  ## Requires persistence.enabled: true
765  ## If defined, PVC must be created manually before volume will be bound
766  existingClaim:
767  ## jenkins data Persistent Volume Storage Class
768  ## If defined, storageClassName: <storageClass>
769  ## If set to "-", storageClassName: "", which disables dynamic provisioning
770  ## If undefined (the default) or set to null, no storageClassName spec is
771  ##  set, choosing the default provisioner.  (gp2 on AWS, standard on
772  ##  GKE, AWS & OpenStack)
773  ##
774  storageClass:
775  annotations: {}
776  labels: {}
777  accessMode: "ReadWriteOnce"
778  size: "8Gi"
779  volumes:
780    - name: jenkins-volume
781  #    emptyDir: {}
782  mounts:
783    - mountPath: /data/jenkins
784      name: jenkins-volume
785      readOnly: false
...
809 serviceAccount:
810  create: false
---------------------------------------------------------------------------------------------------------------------------------------



젠킨스 values.yaml 파일에서 영구데이터 손실을 방지하기 위한 스토리지 설정을 하였습니다.
위와 같이 설정을 하게 되면 “storageClass”가 생략되어 있는데 이는 미 선언 시 기본값으로 “default”를 선언하게 되어있습니다.
AKS, EKS는 “default”값이 적용되지만 구글 GKE에서는 “default”가 아닌 “**standard**”를 선언해야 합니다.
AKS에서 PV 설정을 하게 되면 애저 AKS에서는 아래와 같이 생성됩니다.
네임스페이스 : jenkins-service
---------------------------------------------------------------------------------------------------------------------------------------
# jenkins-sa.yaml

1 ---
  2 apiVersion: v1
  3 kind: ServiceAccount
  4 metadata:
  5  name: jenkins
  6  namespace: jenkins-service # 사전 정의한 젠킨스 네임스페이스
---------------------------------------------------------------------------------------------------------------------------------------



jenkins-sa.yaml 적용
---------------------------------------------------------------------------------------------------------------------------------------
kubectl apply -f jenkins-sa.yaml -n jenkins-service

serviceaccount/jenkins created
clusterrole.rbac.authorization.k8s.io/jenkins unchanged
clusterrolebinding.rbac.authorization.k8s.io/jenkins unchanged
---------------------------------------------------------------------------------------------------------------------------------------



젠킨스 설치
---------------------------------------------------------------------------------------------------------------------------------------
helm install jenkins -n jenkins-service -f values.yaml

Error: INSTALLATION FAILED: must either provide a name or specify --generate-name
devops@connect-vm-devops:~/package_helm/jenkins$ helm install jenkins -n jenkins-service -f values.yaml .
NAME: jenkins
LAST DEPLOYED: Fri Jun 17 02:03:42 2022
NAMESPACE: jenkins-service
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:
  kubectl exec --namespace jenkins-service -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        You can watch the status of by running 'kubectl get svc --namespace jenkins-service -w jenkins'
  export SERVICE_IP=$(kubectl get svc --namespace jenkins-service jenkins --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
  echo http://$SERVICE_IP:8080/login

3. Login with the password from step 1 and the username: admin
4. Configure security realm and authorization strategy
5. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: http:///configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos

For more information on running Jenkins on Kubernetes, visit:
https://cloud.google.com/solutions/jenkins-on-container-engine

For more information about Jenkins Configuration as Code, visit:
https://jenkins.io/projects/jcasc/


NOTE: Consider using a custom image with pre-installed plugins
---------------------------------------------------------------------------------------------------------------------------------------



젠킨스 패스워드 찾기
---------------------------------------------------------------------------------------------------------------------------------------
jsonpath="{.data.jenkins-admin-password}"
secret=$(kubectl get secret -n ${NAMESPACE} jenkins -o jsonpath=$jsonpath)
echo $(echo $secret | base64 --decode)

jsonpath="{.data.jenkins-admin-password}"
secret=$(kubectl get secret -n jenkins-service jenkins -o jsonpath=$jsonpath)
echo $(echo $secret | base64 --decode)
---------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

접속자집계

오늘
1,091
어제
1,872
최대
3,935
전체
808,945
Copyright © www.linuxdata.org All rights reserved.