我在kubernetes中配置jenkins时总是提示“加载插件失败”

问题描述 投票:0回答:1

我可以使用 docker 成功运行 Jenkins,如下所示:

[root@master1 ~]# docker run -p 8080:8080 -p 50000:50000 --name jenkins -v jenkins_home:/var/jenkins_home jenkins401:v1

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
***

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

但是,当我用 Kubernetes 部署 jenkins 时,总是提示“加载插件失败”错误:

[root@node1 ~]# kubectl logs -f jenkins-master-5d69c54b48-2jdxg -n jenkins

java.io.IOException: Failed to load: Command Agent Launcher Plugin (command-launcher 115.vd8b_301cc15d0)
 - Jenkins (2.440.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.676+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Oracle Java SE Development Kit Installer Plugin v80.v8a_dee33ed6f0 (jdk-tool)
java.io.IOException: Failed to load: Oracle Java SE Development Kit Installer Plugin (jdk-tool 80.v8a_dee33ed6f0)
 - Jenkins (2.440.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.676+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin EDDSA API Plugin v0.3.0-4.v84c6f0f4969e (eddsa-api)
java.io.IOException: Failed to load: EDDSA API Plugin (eddsa-api 0.3.0-4.v84c6f0f4969e)
 - Jenkins (2.426.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.677+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Gson API Plugin v2.11.0-41.v019fcf6125dc (gson-api)
java.io.IOException: Failed to load: Gson API Plugin (gson-api 2.11.0-41.v019fcf6125dc)
 - Jenkins (2.426.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.681+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Trilead API Plugin v2.147.vb_73cc728a_32e (trilead-api)
java.io.IOException: Failed to load: Trilead API Plugin (trilead-api 2.147.vb_73cc728a_32e)
 - Failed to load: EDDSA API Plugin (eddsa-api 0.3.0-4.v84c6f0f4969e)
 - Jenkins (2.426.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.683+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Mina SSHD API :: Common v2.13.2-125.v200281b_61d59 (mina-sshd-api-common)
java.io.IOException: Failed to load: Mina SSHD API :: Common (mina-sshd-api-common 2.13.2-125.v200281b_61d59)
 - Jenkins (2.426.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
2024-11-03 03:10:02.683+0000 [id=30]    SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Structs Plugin v338.v848422169819 (structs)
java.io.IOException: Failed to load: Structs Plugin (structs 338.v848422169819)
 - Jenkins (2.414.3) or higher required
        at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:994)
        at hudson.PluginManager$2$1$1.run(PluginManager.java:555)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:177)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1164)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:221)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:120)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
...

jenkins的配置如下:

apiVersion: v1
kind: Namespace
metadata:
  name: jenkins
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: jenkins
  namespace: jenkins
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: jenkins-crb
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: jenkins
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-master
  namespace: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      devops: jenkins-master
  template:
    metadata:
      labels:
        devops: jenkins-master
    spec:
      nodeSelector:
        jenkins: "true"
      serviceAccount: jenkins
      initContainers:
      - name: fix-permissions
        image: busybox
        command: ["sh","-c","chown -R 1000:1000 /var/jenkins_home"]
        securityContext:
          privileged: true
        volumeMounts:
        - name: jenkinshome
          mountPath: /var/jenkins_home
      containers:
      - name: jenkins
        image: jenkins401:v1
        imagePullPolicy: IfNotPresent
        ports:
        - name: http
          containerPort: 8080
        - name: slavelistener
          containerPort: 50000
        volumeMounts:
        - name: jenkinshome
          mountPath: /var/jenkins_home
        env:
        - name: JAVA_OPTS
          value: "-Xms4096m -Xmx5120m -Duser.timezone=Asia/Shanghai -Dhudson.model.DirectoryBrowserSupport.CSP="
      volumes:
        - name: jenkinshome
          hostPath:
            path: /var/jenkins_home/
---
apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: jenkins
spec:
  ports:
    - name: http
      port: 8080
      targetPort: 8080
    - name: slavelistener
      port: 50000
      targetPort: 50000
  selector:
    devops: jenkins-master
---
apiVersion: networking.k8s.io/v1 
kind: Ingress
metadata:
  name: jenkins-web
  namespace: jenkins
spec:
  rules:
    - host: jenkins.qq.com
      http:
        paths:
          - backend:
              service:
                name: jenkins
                port:
                  number: 8080
            path: /
            pathType: Prefix

如何解决这些插件问题? 我的 kubernetes 版本:

[root@node1 ~]# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.9", GitCommit:"7a576bc3935a6b555e33346fd73ad77c925e9e4a", GitTreeState:"clean", BuildDate:"2021-07-15T21:00:30Z", GoVersion:"go1.15.14", Compiler:"gc", Platform:"linux/amd64"}

我尝试使用另一个jenkins版本,仍然会遇到上面提到的这个问题。我不知道上面这个yaml是否正确。

kubernetes jenkins
1个回答
0
投票

我发现错误,在kubernetes上部署jenkins时必须使用StatefulSet。

© www.soinside.com 2019 - 2024. All rights reserved.