1. 15.2 深入理解Helm
1.1.1. Helm组件
[root@linux-node1 ~]# tree ~/.helm/
/root/.helm/
├── cache
│ └── archive
│ └── jenkins-0.13.5.tgz
├── plugins
├── repository
│ ├── cache
│ │ ├── local-index.yaml -> /root/.helm/repository/local/index.yaml
│ │ └── stable-index.yaml
│ ├── local
│ │ └── index.yaml
│ └── repositories.yaml
└── starters
7 directories, 5 files
默认缓存的文件
[root@linux-node1 ~]# cd .helm/cache/archive/
[root@linux-node1 archive]# ls -l
total 16
-rw-r--r-- 1 root root 12650 Jul 26 19:21 jenkins-0.13.5.tgz
[root@linux-node1 archive]# tar zxf jenkins-0.13.5.tgz
[root@linux-node1 archive]# mv jenkins ~/.helm/repository/local/
[root@linux-node1 ~]# cd ~/.helm/repository/local/jenkins/
[root@linux-node1 jenkins]# tree
.
├── Chart.yaml
├── OWNERS
├── README.md
├── templates
│ ├── config.yaml
│ ├── _helpers.tpl
│ ├── home-pvc.yaml
│ ├── jenkins-agent-svc.yaml
│ ├── jenkins-master-deployment.yaml
│ ├── jenkins-master-ingress.yaml
│ ├── jenkins-master-networkpolicy.yaml
│ ├── jenkins-master-svc.yaml
│ ├── jenkins-test.yaml
│ ├── jobs.yaml
│ ├── NOTES.txt
│ ├── rbac.yaml
│ ├── secret.yaml
│ ├── service-account.yaml
│ └── test-config.yaml
└── values.yaml
1 directory, 19 files
1.1.2. 自定义Jenkins的Chart
修改为NodePort
[root@linux-node1 jenkins]# vim values.yaml
ServiceType: NodePort
检查
[root@linux-node1 ~]# helm lint ~/.helm/repository/local/jenkins/
==> Linting /root/.helm/repository/local/jenkins/
Lint OK
1 chart(s) linted, no failures
查看有哪些应用
[root@linux-node1 ~]# helm list
NAME REVISION UPDATED STATUS CHART NAMESPACE
viable-seal 1 Thu Jul 26 19:21:07 2018 DEPLOYED jenkins-0.13.5 default
[root@linux-node1 ~]# helm delete --purge viable-seal
release "viable-seal" deleted
[root@linux-node1 ~]# helm install ~/.helm/repository/local/jenkins/ --name devops-jenkins
NAME: devops-jenkins
LAST DEPLOYED: Thu Jul 26 19:36:10 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Secret
NAME TYPE DATA AGE
devops-jenkins Opaque 2 0s
==> v1/ConfigMap
NAME DATA AGE
devops-jenkins 3 0s
devops-jenkins-tests 1 0s
==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
devops-jenkins Pending 0s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
devops-jenkins-agent ClusterIP 10.1.74.175 <none> 50000/TCP 0s
devops-jenkins NodePort 10.1.3.112 <none> 8080:23558/TCP 0s
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
devops-jenkins 1 1 1 0 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
devops-jenkins-64d54b79c-pwjfb 0/1 Pending 0 0s
NOTES:
1. Get your 'admin' user password by running:
printf $(kubectl get secret --namespace default devops-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services devops-jenkins)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT/login
3. Login with the password from step 1 and the username: admin
For more information on running Jenkins on Kubernetes, visit:
https://cloud.google.com/solutions/jenkins-on-container-engine
查看状态
[root@linux-node1 ~]# helm status devops-jenkins