Jenkins 這老紳士是一個軟體開發的持續整合服務的開源套件, 本篇筆記將介紹如何安裝一個本地端的 pod 運行的 Jenkins.
PS C:\k8s\jaeger-kubernetes> docker pull eldada-docker-examples.bintray.io/jenkins:lts-k8s
lts-k8s: Pulling from jenkins
PS C:\k8s\jaeger-kubernetes> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<略...>
eldada-docker-examples.bintray.io/jenkins lts-k8s e6af33a2fa99 8 months ago 1.27GB
<略...>
# values.yaml
initContainerImage: "alpine:3.6"
replicaCount: 1
imagePullSecrets:
image:
repository: eldada-docker-examples.bintray.io/jenkins # Change to your local image tag
tag: lts-k8s
pullPolicy: Always
did:
image:
repository: docker
tag: 18.02.0-dind
## Set the admin user
adminUser: admin
## Make sure to replace the default password
adminPassword: password
service:
name: jenkins-k8s
type: LoadBalancer
## Whitelist the IPs that can access Jenkins
loadBalancerSourceRanges:
- 0.0.0.0/0
externalPort: 8080
internalPort: 8080
## Make sure the javaOps and resources are aligned to avoid conflicts
javaOpts: "-Xms512m -Xmx2g"
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: 300m
memory: 2Gi
storage:
persistence:
enabled: true
accessMode: ReadWriteOnce
capacity: 50Gi
PS C:\k8s\jenkins-in-kubernetes> helm upgrade --install jenkins ./helm/jenkins-k8s
Release "jenkins" does not exist. Installing it now.
NAME: jenkins
LAST DEPLOYED: Sun Nov 4 22:59:05 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
jenkins-jenkins-k8s LoadBalancer 10.103.194.182 localhost 8080:31185/TCP 1s
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
jenkins-jenkins-k8s 1 1 1 0 1s
==> v1/Pod(related)
NAME AGE
jenkins-jenkins-k8s-5467598855-fm986 1s
jenkins-jenkins-k8s-657cb4c76d-9d2pf 4m55s
==> v1/Secret
NAME TYPE DATA AGE
jenkins-jenkins-k8s Opaque 2 1s
==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
jenkins-k8s Pending pvc-2cc4ace8-e042-11e8-8dfc-00155d54101d 0 hostpath 1s
NOTES:
Jenkins for Kubernetes deployed!
Get the Jenkins URL
===================
export SERVICE_IP=$(kubectl get svc --namespace default jenkins-jenkins-k8s -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://${SERVICE_IP}:8080/
admin/password
)