반응형
Jenkins 설치 방법
jenkins 네임스페이스 생성
$ kubectl create namespace jenkins
jenkins.yaml 파일 편집
$ vim jenkins.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins
spec:
replicas: 1
selector:
matchLabels:
app: jenkins
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: jenkins/jenkins:lts
ports:
- name: http-port
containerPort: 8080
- name: jnlp-port
containerPort: 50000
volumeMounts:
- name: jenkins-vol
mountPath: /var/jenkins_vol
volumes:
- name: jenkins-vol
emptyDir: {}
deployment 생성
$ kubectl create -f jenkins.yaml --namespace jenkins
deployment.apps/jenkins created
포드 상태 확인
$ kubectl get pods -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins-794699f9bc-pwtrh 1/1 Running 0 64s
jenkins-service.yaml 파일 편집
apiVersion: v1
kind: Service
metadata:
name: jenkins
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
nodePort: 30000
selector:
app: jenkins
---
apiVersion: v1
kind: Service
metadata:
name: jenkins-jnlp
spec:
type: ClusterIP
ports:
- port: 50000
targetPort: 50000
selector:
app: jenkins
서비스 생성
$ kubectl create -f jenkins-service.yaml --namespace jenkins
service/jenkins created
service/jenkins-jnlp created
서비스 확인
$ kubectl get services --namespace jenkins
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
jenkins NodePort 10.98.152.104 <none> 8080:30000/TCP 12s
jenkins-jnlp ClusterIP 10.110.21.239 <none> 50000/TCP 12s
포드 네임 확인 후 로그에서 관리자 패스워드 확인
$ kubectl get pods -n jenkins
NAME READY STATUS RESTARTS AGE
jenkins-794699f9bc-pwtrh 1/1 Running 0 17m
$ kubectl logs jenkins-794699f9bc-pwtrh -n jenkins
Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
...
2020-11-03 05:26:51.191+0000 [id=25] INFO jenkins.install.SetupWizard#init:
*************************************************************
*************************************************************
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
73d1cc2ba7db4c9c996b573431d86d3b
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
...
2020-11-03 05:27:08.939+0000 [id=39] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 19,740 ms
jenkins 웹 UI
원본 URL : https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-kubernetes
728x90
반응형
'리눅스' 카테고리의 다른 글
[kubernetes] kubectl get (0) | 2020.11.05 |
---|---|
kubernetes 클러스터 내 모든 네임스페이스의 파드 상태 확인 (0) | 2020.11.04 |
[kubernetes] MetalLB 설치 (0) | 2020.11.03 |
쿠버네티스에 Flannel 네트워크 플러그인을 설치하는 방법 (0) | 2020.11.03 |
[kubernetes] component statuses 에러 (0) | 2020.11.03 |