400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

helm怎么安装jenkins

本篇内容主要讲解“helm怎么安装jenkins”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“helm怎么安装jenkins”吧!

目前创新互联已为成百上千家的企业提供了网站建设、域名、虚拟主机、网站改版维护、企业网站设计、景泰网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

本次实战的namespace

本次实战使用名为helm-jenkins的namespace,执行以下命令创建:

kubectl create namespace helm-jenkins

创建PV

为了后面的jenkins服务顺利启动,需要预先部署好pv:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: helm-jenkins
  namespace: helm-jenkins
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  nfs:
    path: /usr/local/work/test/002
    server: 192.168.133.142
[root@node1 helm-jenkins]# kubectl get pv
NAME           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM        STORAGECLASS   REASON   AGE
helm-jenkins   10Gi       RWO            Recycle          Available                                        5s
                         14h

helm安装jenkins

[root@node1 helm-jenkins]# helm version
Client: &version.Version{SemVer:"v2.16.1", GitCommit:"bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.16.1", GitCommit:"bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState:"clean"}
[root@node1 helm-jenkins]# helm repo list
NAME   	URL                                                   
stable 	https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm install --namespace helm-jenkins --name my-jenkins stable/jenkins
NOTES:
1. Get your 'admin' user password by running:
  printf $(kubectl get secret --namespace helm-jenkins my-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:
  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 helm-jenkins -w my-jenkins'
  export SERVICE_IP=$(kubectl get svc --namespace helm-jenkins my-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

上述内容的第一条给出了重要提示:获取admin账号密码的方法,执行命令即可:

printf $(kubectl get secret --namespace helm-jenkins my-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo

如下图红框所示,我这里得到了admin密码为Eq6WxHvJ2V:

[root@node1 helm-jenkins]# kubectl get svc -n helm-jenkins
NAME               TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
my-jenkins         LoadBalancer   10.233.10.35        8080:31763/TCP   31m
my-jenkins-agent   ClusterIP      10.233.35.20           50000/TCP        31m

设置kubernetes插件

为了让jenkins在以下模式工作,还需要设置kubernetes插件

[root@node1 helm-jenkins]# kubectl get serviceaccount -n helm-jenkins
NAME      SECRETS   AGE
default   1         3h65m

可见jenkins容器的serviceaccount是default

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: rbac-helm-jenkins-default
  namespace: helm-jenkins
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: default
  namespace: helm-jenkins

体验Freestyle project

[root@node1 helm-jenkins]# kubectl get pods -n helm-jenkins
NAME                          READY   STATUS              RESTARTS   AGE
default-66vcq                 0/1     ContainerCreating   0          1s
my-jenkins-74bcdfc566-jbw28   1/1     Running             0          5h6m

到此,相信大家对“helm怎么安装jenkins”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


网站栏目:helm怎么安装jenkins
当前URL:http://www.bluegullmedia.com/article/ijggod.html

其他资讯

让你的专属顾问为你服务

0.0441s