首页 > 解决方案 > 在 minikube 中运行 jenkins 时出错

问题描述

在 pod 内运行 jenkins 时,它显示 jenkins 已启动并正在运行,但出现此长错误。

我在 pod 内执行的命令:

docker run --name=jenkins-container docker-jenkins

错误日志:

 Running from: /usr/share/jenkins/jenkins.war
    webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
    2020-06-07 03:32:13.394+0000 [id=1]     INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @519ms to org.eclipse.jetty.util.log.JavaUtilLog
    2020-06-07 03:32:13.588+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
    2020-06-07 03:32:15.180+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
    2020-06-07 03:32:15.302+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.27.v20200227; built: 2020-02-27T18:37:21.340Z; git: a304fd9f351f337e7c0e2a7c28878dd536149c6c; jvm 1.8.0_242-b08
    2020-06-07 03:32:15.764+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
    2020-06-07 03:32:15.888+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
    2020-06-07 03:32:15.888+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
    2020-06-07 03:32:15.897+0000 [id=1]     INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
    2020-06-07 03:32:16.757+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
    2020-06-07 03:32:16.944+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@5b800468{Jenkins v2.239,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
    2020-06-07 03:32:17.001+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@6f43c82{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
    2020-06-07 03:32:17.001+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started @4126ms
    2020-06-07 03:32:17.003+0000 [id=21]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
    2020-06-07 03:32:18.622+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
    2020-06-07 03:32:18.725+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
    2020-06-07 03:32:20.825+0000 [id=33]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
    2020-06-07 03:32:20.838+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
    2020-06-07 03:32:20.863+0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
    2020-06-07 03:32:21.808+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
    2020-06-07 03:32:21.809+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
    2020-06-07 03:32:21.957+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
    2020-06-07 03:32:21.960+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
    2020-06-07 03:32:22.086+0000 [id=46]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
    2020-06-07 03:32:22.136+0000 [id=46]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
    2020-06-07 03:32:22.635+0000 [id=27]    INFO    jenkins.install.UpgradeWizard#applyForcedChanges: New API token system configured with insecure options to keep legacy behavior
    2020-06-07 03:32:22.884+0000 [id=46]    INFO    hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
    java.net.NoRouteToHostException: No route to host (Host unreachable)
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
            at java.net.Socket.connect(Socket.java:607)
            at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
            at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
            at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
            at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
            at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
            at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
            at hudson.model.DownloadService.loadJSON(DownloadService.java:114)
            at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:212)
            at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:207)
            at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1767)
            at hudson.util.Retrier.start(Retrier.java:63)
            at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1738)
            at jenkins.DailyCheck.execute(DailyCheck.java:93)
            at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
            at java.lang.Thread.run(Thread.java:748)
    2020-06-07 03:32:22.885+0000 [id=46]    INFO    hudson.util.Retrier#start: Calling the listener of the allowed exception 'No route to host (Host unreachable)' at the attempt #1 to do the action check updates server
    2020-06-07 03:32:22.887+0000 [id=46]    INFO    hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
    2020-06-07 03:32:22.888+0000 [id=46]    SEVERE  hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: NoRouteToHostException: No route to host (Host unreachable)
    2020-06-07 03:32:22.900+0000 [id=46]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 802 ms
    2020-06-07 03:32:23.166+0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
    2020-06-07 03:32:23.393+0000 [id=20]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running

任何解决方案?

如何在kubernetes上部署jenkins并执行

标签: ubuntujenkinsnamespacesminikubekubernetes-pod

解决方案


该错误与检查 Internet 服务器的 Jenkins 插件更新有关。

hudson.PluginManager#doCheckUpdatesServer:1 次尝试检查更新站点时出错。最后一个例外是:NoRouteToHostException:没有到主机的路由(主机无法访问)

从字面上看,它是由容器内不正确的网络配置引起的:没有到更新服务器的静态 IP 路由,也没有默认 IP 路由。

如果你在 Docker 中运行 Docker,你必须注意正确的网络配置

Minikube 部署通常仅用于测试目的,因此您可以完全忽略该错误。但该错误的根本原因可能会阻止您安装插件以及在您的作业中使用其他 Internet 或 LAN 资源。

正如Nick已经提到的,最好以“Kubernetes 方式”部署 Jenkins,使用kubectl,HelmJenkins operator


推荐阅读