【问题标题】:Getting Error while running jenkins in minikube在 minikube 中运行 jenkins 时出错
【发布时间】:2020-06-07 03:49:04
【问题描述】:

在 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并执行

【问题讨论】:

    标签: ubuntu jenkins namespaces minikube kubernetes-pod


    【解决方案1】:

    在 pod 内运行 Jenkins 我在 pod 内执行的命令: docker run --name=jenkins-container docker-jenkins

    Pod 运行 Docker 容器,如果 Jenkins 从 Pod 内部使用 docker run 启动,则 Jenkins 将是“Docker 中的 Docker”。

    当 Docker 在另一个 Docker 容器中运行时,可能会遇到 a lot of problems。更好的做法是容器不运行自己的 Docker 守护进程,而是连接到宿主系统的 Docker 守护进程。

    更好的解决方案是将 Jenkins 作为 Pod(而不是作为 Pod 内的容器)运行。

    如何在 Kubernetes 上部署 Jenkins 并执行

    已经有一个很好的script 允许您设置一个持久的 Jenkins 主服务器,并在 minikube 上动态启动 Jenkins 从服务器。 基本上它指的是how to set up Jenkins on minikube上的以下(已验证)完整教程。

    希望对您有所帮助。

    【讨论】:

      【解决方案2】:

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

      hudson.PluginManager#doCheckUpdatesServer:1 次尝试检查更新站点时出错。最后一个异常是:NoRouteToHostException: No route to host (Host unreachable)

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

      如果您在 Docker 中运行 Docker,则必须注意 proper network configuration

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

      由于Nick 已经mentioned,最好以“Kubernetes 方式”部署 Jenkins,使用kubectlHelmJenkins operator

      【讨论】:

        猜你喜欢
        • 2022-06-11
        • 1970-01-01
        • 1970-01-01
        • 2016-02-26
        • 1970-01-01
        • 2014-02-02
        • 2019-01-28
        • 1970-01-01
        • 2020-05-08
        相关资源
        最近更新 更多