在jenkins里面手动安装插件的操作

问题:在浏览器上进行升级的时候总是最后一个插件jenkins.war,显示红色安装失败
在寻求解决办法百度上查看所,自己去下后放到pod的指定目录中就可以了,

1、首先下载

jenkins.war 在jenkins上点击下载就能下载下来,然后传到共享存储200上面
目录可以用describe看到的

2、查看共享存储主机和目录

[root@hdss7-21 ~]# kubectl describe po -ninfra jenkins-b56cf89cc-rlxxk
Name:           jenkins-b56cf89cc-rlxxk
Namespace:      infra
Priority:       0
Node:           hdss7-22.host.com/10.4.7.22
Start Time:     Sat, 04 Sep 2021 14:22:02 +0800
Labels:         app=jenkins
                name=jenkins
                pod-template-hash=b56cf89cc
Annotations:    <none>
Status:         Running
IP:             172.7.22.4
Controlled By:  ReplicaSet/jenkins-b56cf89cc
Containers:
  jenkins:
    Container ID:   docker://195abb340275c6e2664bdc1bb30e0800cf058f2ce80c65de923a28dd3f792291
    Image:          harbor.od.com/infra/jenkins:v2.190.3
    Image ID:       docker-pullable://harbor.od.com/infra/jenkins@sha256:3cf756bb93a81fe6c51c6464e16bbed815e45cc353037a9f73f4dd00d7a577fd
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sat, 04 Sep 2021 14:22:03 +0800
    Ready:          True
    Restart Count:  0
    Environment:
      JAVA_OPTS:  -Xmx512m -Xms512m
    Mounts:
      /run/docker.sock from docker (rw)
      /usr/share/jenkins/jenkins.war from jenkins-jar (rw)
      /var/jenkins_home from data (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-2hn7c (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  data:
    Type:      NFS (an NFS mount that lasts the lifetime of a pod)
    Server:    hdss7-200
    Path:      /data/nfs-volume/jenkins_home       ##这就是共享的目录和上面那一句话是主机
    ReadOnly:  false
  jenkins-jar:
    Type:          HostPath (bare host directory volume)
    Path:          /jenkins.war
    HostPathType:  
  docker:
    Type:          HostPath (bare host directory volume)
    Path:          /run/docker.sock
    HostPathType:  
  default-token-2hn7c:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-2hn7c
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age    From                        Message
  ----    ------     ----   ----                        -------
  Normal  Scheduled  3m35s  default-scheduler           Successfully assigned infra/jenkins-b56cf89cc-rlxxk to hdss7-22.host.com
  Normal  Pulled     3m34s  kubelet, hdss7-22.host.com  Container image "harbor.od.com/infra/jenkins:v2.190.3" already present on machine
  Normal  Created    3m34s  kubelet, hdss7-22.host.com  Created container jenkins
  Normal  Started    3m34s  kubelet, hdss7-22.host.com  Started container jenkins

3、传文件到共享目录

然后把文件传刚才下载的文件放在200的这个共享目录下面
在这里插入图片描述

4、更新dp.yaml文件

[root@hdss7-200 jenkins_home]# cd -
/data/k8s-yaml/jenkins
[root@hdss7-200 jenkins]# cat dp.yaml 
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: jenkins
  namespace: infra
  labels: 
    name: jenkins
spec:
  replicas: 1
  selector:
    matchLabels: 
      name: jenkins
  template:
    metadata:
      labels: 
        app: jenkins 
        name: jenkins
    spec:
      volumes:
      - name: data
        nfs: 
          server: hdss7-200
          path: /data/nfs-volume/jenkins_home
      - name: jenkins-jar                       ##新增
        hostPath:                               ##新增
          path: /jenkins.war                    ##新增
          type: ''                              ##新增
      - name: docker
        hostPath: 
          path: /run/docker.sock   
          type: ''
      containers:
      - name: jenkins
        image: harbor.od.com/infra/jenkins:v2.190.3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8080
          protocol: TCP
        env:
        - name: JAVA_OPTS
          value: -Xmx512m -Xms512m
        volumeMounts:
        - name: data
          mountPath: /var/jenkins_home
        - name: docker
          mountPath: /run/docker.sock
        - name: jenkins-jar                                          ##新增
          mountPath: /usr/share/jenkins/jenkins.war                  ##新增
      imagePullSecrets:
      - name: harbor
      securityContext: 
        runAsUser: 0
  strategy:
    type: RollingUpdate
    rollingUpdate: 
      maxUnavailable: 1
      maxSurge: 1
  revisionHistoryLimit: 7
  progressDeadlineSeconds: 600
[root@hdss7-200 jenkins]# 

5、分发软件到集群中

[root@hdss7-200 jenkins_home]# for i in 10.4.7.21 10.4.7.22;do scp jenkins.war $i:/;done

6、在集群中更新资源配置清单

[root@hdss7-21 ~]# kubectl apply -f http://k8s-yaml.od.com/jenkins/dp.yaml
deployment.extensions/jenkins configured
[root@hdss7-21 ~]# kubectl get pod -A |grep jenkins
infra         jenkins-54b8469cf9-4r7p9                1/1     Running            0          2s
infra         jenkins-b56cf89cc-ffd2w                 0/1     Terminating        3          84s
[root@hdss7-21 ~]# kubectl get pod -A |grep jenkins
infra         jenkins-54b8469cf9-4r7p9                1/1     Running            0          4s
[root@hdss7-21 ~]# kubectl get pod -A |grep jenkins
infra         jenkins-54b8469cf9-4r7p9                1/1     Running            0          4s

7、在到浏览器就可以使用蓝海那个插件了

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值