k8s--Jenkins拒绝加载此版本Blue Ocean

问题:在部署Jenkins安装Blue Ocean插件,提示警告此版本不能使用Blue Ocean

解决方案为下载新版本的Jenkins

思考:应该下载那个版本的jenkins,警告提示(最新的或者版本Jenkins 2.249.1),博主经过测试,下载Jenkins 2.249.1,在重新构建dockerfile时候(此文章跟Kubernetes部署jenkins息息相关),报错提示 (docker-scan-plugin 找不到安装程序),运行Jenkins 2.249.1镜像,进入Jenkins 2.249.1容器后,由于是debina9.1系统(通过cat /etc/debian_version)尝试过apt 更新阿里源,依旧提示无法获取docker-scan-plugin。也尝试改过构建docker客户端脚本get-docker.sh源码,使其脚本中使用镜像源,都变成阿里源也不行, 无奈此版本不进行试验并使用。于是想到用最新的jenkins 镜像(pull  jenkins/jenkins:latest) ,重新构建了dockerfile时候,在(+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends  docker-ce-cli docker-scan-plugin docker-ce >/dev/null)的时候也是一闪而过,应该也是那个组件没有安装成功,也尝试改get-docker.sh中为阿里源也不行,应该还是debina的apt层面导致,于是想更新apt 国内源(debina11.1系统),由于系统太新,通过网上查询的资料,更新apt源后并使用会报错,无奈停止。于是去了jenkins的官网Jenkins,得知当前稳定长期维护版本为 2.319.1,所以使用此版本,测试目前感觉无问题

操作过程:以下操作只是针对(Kubernetes部署jenkins)不同之处,相同操作就不写了

1、下载安装Jenkins 2.319.1

[root@7-200 ~]# docker pull jenkins/jenkins:2.319.1

[root@7-200 ~]# docker image ls |grep jenkins
harbor.od.com:180/infra/jenkins      v2.190.3                        612c19e23328   2 days ago          589MB
jenkins/jenkins                      2.319.1                         2a4bbe50c40b   6 days ago          441MB
jenkins/jenkins                      2.190.3                         22b8b9a84dbe   2 years ago         568MB
harbor.od.com:180/public/jenkins     v2.190.3                        22b8b9a84dbe   2 years ago         568MB

[root@7-200 ~]# docker tag 2a4bbe50c40b harbor.od.com:180/public/jenkins:v2.319.1
[root@7-200 ~]# docker login harbor.od.com:180
[root@7-200 ~]# docker push harbor.od.com:180/public/jenkins:v2.319.1
[root@7-200 ~]# cd /data/dockerfile/jenkins
[root@7-200 jenkins]# cat /data/dockerfile/jenkins/Dockerfile |grep FROM     # 把FROM镜像修改就行
FROM harbor.od.com:180/public/jenkins:v2.319.1

2、制作Jenkins镜像

[root@7-200 jenkins]# docker image build -t harbor.od.com:180/infra/jenkins:v2.319.1 ./
Sending build context to Docker daemon  155.1kB
Step 1/7 : FROM harbor.od.com:180/public/jenkins:v2.319.1
 ---> 2a4bbe50c40b
Step 2/7 : USER root
 ---> Running in 16a17b89c299
Removing intermediate container 16a17b89c299
 ---> 8cb9c84ca616
Step 3/7 : RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
 ---> Running in dae0e2672e24
Removing intermediate container dae0e2672e24
 ---> 29a8145146c0
Step 4/7 : ADD id_rsa /root/.ssh/id_rsa
 ---> 9ef9dbf55f82
Step 5/7 : ADD config.json /root/.docker/config.json
 ---> 8a0cd70fb191
Step 6/7 : ADD get-docker.sh /get-docker.sh
 ---> f82c76ff04e6
Step 7/7 : RUN echo "      StrictHostKeyChecking no" >> /etc/ssh/ssh_config && sh /get-docker.sh ; rm -f get-docker.sh
 ---> Running in 37dd34c789b2
# Executing docker install script, commit: 93d2499759296ac1f9c510605fef85052a2c32be
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
debconf: delaying package configuration, since apt-utils is not installed
+ sh -c curl -fsSL "https://download.docker.com/linux/debian/gpg" | gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
+ sh -c echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends  docker-ce-cli docker-scan-plugin docker-ce >/dev/null
debconf: delaying package configuration, since apt-utils is not installed
+ version_gte 20.10
+ [ -z  ]
+ return 0
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce-rootless-extras >/dev/null
debconf: delaying package configuration, since apt-utils is not installed

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

    dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
         to root access on the host. Refer to the 'Docker daemon attack surface'
         documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================

Removing intermediate container 37dd34c789b2
 ---> befc58acc103
Successfully built befc58acc103
Successfully tagged harbor.od.com:180/infra/jenkins:v2.319.1

注:其中报错都是debconf: delaying package configuration, since apt-utils is not installed,
意思是没有没有安装apt-utils,目前看未影响docekr,所以可不必理会,博主测试过,
进入此镜像容器中,apt-get install apt-utils 是没问题的,如果想解决此问题,可以在
get-docker.sh中,在安装apt-get install -y -qq apt-transport-https之前加入安装apt-utils

3、修改kubectl配置

[root@7-200 jenkins]# docker login harbor.od.com:180
[root@7-200 jenkins]# docker push harbor.od.com:180/infra/jenkins:v2.319.1

[root@7-200 jenkins]# cd /data/k8s-yaml/jenkins/
[root@7-200 jenkins]# cat deployment.yaml |grep image    # 把image更改v2.319.1
        image: harbor.od.com:180/infra/jenkins:v2.319.1
        imagePullPolicy: IfNotPresent
      imagePullSecrets:

重新应用到kubectl:
root@7-21 jenkins]# kubectl apply -f http://k8s-yaml.od.com/jenkins/deployment.yaml

4、重新登录容器

账户密码不变,还是admin, admin123

这时候就可以安装Blue Ocean ,如果在之前的2.190.3安装了,就不需要安装了

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐