[kubeadm & helm] CNI(calico) & jenkins 설치
- advanced/Devops
- 2022. 9. 20.
calico(CNI의 일종) 설치
curl https://projectcalico.docs.tigera.io/manifests/calico.yaml -O
# yaml 실행
kubectl apply -f calico.yaml
설치 확인
noelbird@noelbirdk8smaster:~/jenkins$ k get po -n kube-system
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-58dbc876ff-hxrfx 1/1 Running 0 120m
calico-node-bs2l2 1/1 Running 0 120m
calico-node-mmkqq 1/1 Running 0 120m
...
참고 블로그: https://majjangjjang.tistory.com/182
jenkins 설치(by helm)
- Persistent Volume 준비하기
저는 hostPath 유형으로 Persistent Volume을 준비했습니다.
storage는 jenkins는 기본적으로 8Gi를 요구하지만, 저는 용량이 많지 않기 때문에 8Gi로 수정했습니다.
accessModes는 ReadWriteOnce
를 jenkins helm 설치시에 PVC(Persistent Volume Claim)이 요구합니다.
다음과 같이 pv.yaml 파일을 적절한 위치에 작성합니다.
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-1
spec:
capacity:
storage: 2Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /home/noelbird/jenkins/pv
type: Directory
여기에서 트러블 슈팅을 하면서 시간을 많이 소비했습니다. hostPath로 설정하면 pod이 배정되는 곳의 hostPath를 사용하기 때문에, type을 Directory로 해주는 경우에 폴더를 생성하고 적절한 권한설정을 해주어야 합니다.
- helm chart의 custom value 세팅
helm repo add jenkins https://charts.jenkins.io # 헬름 repo를 jenkins라는 이름으로 추가합니다.
noelbird@noelbirdk8smaster:~/jenkins$ helm search repo jenkins
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/jenkins 11.0.2 2.361.1 Jenkins is an open source Continuous Integratio...
codecentric/jenkins 1.7.1 2.222.3 CHART DEPRECATED - The leading open source auto...
jenkins/jenkins 4.2.4 2.361.1 Jenkins - Build great things at any scale! The ...
jenkins는 jenkins/jenkins라는 이름으로 4.2.4 버전의 차트가 제공됩니다.
helm show values jenkins/jenkins > values.yaml
vi values.yaml # 저는 8Gi를 검색해서 persistence.size를 2Gi로만 수정했습니다.
helm install jenkins jenkins/jenkins -f values.yaml
설치가 완료되면 다음과 같은 메시지가 보입니다.
NAME: jenkins
LAST DEPLOYED: Mon Sep 19 13:27:39 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:
kubectl exec --namespace default -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:
echo http://127.0.0.1:8080
kubectl --namespace default port-forward svc/jenkins 8080:8080
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
'advanced > Devops' 카테고리의 다른 글
[kubernetes] CKA & CKAD 공부내용 정리 (0) | 2022.11.24 |
---|---|
[kubernetes] worker node의 ip가 바뀐 경우 해결 방법 (0) | 2022.09.20 |
kubeadm on Ubuntu 22.04 설치시 트러블 슈팅 (0) | 2022.09.19 |
[CKAD] 2일차 - job & cronjob (0) | 2022.09.16 |
[CKAD] 1일차 (0) | 2022.09.15 |