代码之家  ›  专栏  ›  技术社区  ›  user4948798

hostPathVolume未安装在Kubernetes吊舱上(动态Jenkins代理)

  •  0
  • user4948798  · 技术社区  · 4 年前
    Environment: 
    Jenkins - Version 2.235.5 (LTS)
    Kubernetes Jenkins Plugin  - 1.27.7
    
    K8s-Master & Worker Server Details:-
    OS - CentOS Linux release 7.9.2009 (Core) & Kernal - 3.10.0-1160.6.1.el7.x86_64
    Docker Version - 19.03.12
    Client Version: v1.19.0
    Server Version: v1.19.0
    

    我正试图登上一座 hostPathVolume 通过Jenkins Kubernetes插件 podTemplate 当吊舱通过Jenkins启动时,掌握我的K8s工作人员没有安装在K8s吊舱上的路径(Jenkins代理)。

    我有下面的脚本管道。

    podTemplate(label: 'mypod', containers: [
        containerTemplate(name: 'git', image: 'ubuntu/16.04', ttyEnabled: true, command: 'cat'),
        containerTemplate(name: 'maven', image: 'ubuntu/16.04', command: 'cat', ttyEnabled: true)
      ],
      volumes: [
        hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
      ]
      ) {
        node('mypod') {
            stage('Check running containers') {
                container('docker') {
                    // example to show you can run docker commands when you mount the socket
                    sh 'hostname'
                    sh 'hostname -i'
                    sh 'docker ps'
                }
            }
    ..... further stages....
    

    K8s集群Jenkins代理pod日志

    # kubectl logs -f jenkins_job-10-b04wk-dn4gf-llpbp -c jnlp
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main createEngine
    INFO: Setting up agent: jenkins_job-10-b04wk-dn4gf-llpbp
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener <init>
    INFO: Jenkins agent is running in headless mode.
    Dec 05, 2020 5:41:16 AM hudson.remoting.Engine startEngine
    INFO: Using Remoting version: 4.3
    Dec 05, 2020 5:41:16 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
    INFO: Using /home/jenkins/agent/remoting as a remoting work directory
    Dec 05, 2020 5:41:16 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
    INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Locating server among [http://jenkins-server/jenkins/]
    Dec 05, 2020 5:41:16 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
    INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Agent discovery successful
      Agent address: jenkins-server
      Agent port:    40003
      Identity:      23:66:a9:70:0b:f2:03:e0:47:44:0d:ee:7e:ce:8c:31
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Handshaking
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Connecting to jenkins-server:40003
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Trying protocol: JNLP4-connect
    Dec 05, 2020 5:41:16 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Remote identity confirmed: 23:66:a9:70:0b:f2:03:e0:47:44:0d:ee:7e:ce:8c:31
    Dec 05, 2020 5:41:17 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Connected
    Dec 05, 2020 5:41:21 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave$SlaveDisconnector call
    INFO: Disabled slave engine reconnects.
    Dec 05, 2020 5:41:21 AM hudson.util.ProcessTree get
    WARNING: Error while determining if vetoers exist
    hudson.remoting.RequestAbortedException: hudson.remoting.ChannelClosedException: Channel "unknown": Protocol stack cannot write data anymore. It is not open for write
            at hudson.remoting.Request.abort(Request.java:340)
            at hudson.remoting.Channel.terminate(Channel.java:1081)
            at hudson.remoting.Channel.close(Channel.java:1482)
            at hudson.remoting.Channel.close(Channel.java:1446)
            at hudson.remoting.Channel$CloseCommand.execute(Channel.java:1313)
            at hudson.remoting.Channel$1.handle(Channel.java:606)
            at hudson.remoting.AbstractByteBufferCommandTransport.processCommand(AbstractByteBufferCommandTransport.java:203)
            at hudson.remoting.AbstractByteBufferCommandTransport.receive(AbstractByteBufferCommandTransport.java:189)
            at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onRead(ChannelApplicationLayer.java:187)
            at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecv(ApplicationLayer.java:206)
            at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecv(ProtocolStack.java:668)
            at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processRead(SSLEngineFilterLayer.java:369)
            at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecv(SSLEngineFilterLayer.java:117)
            at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecv(ProtocolStack.java:668)
            at org.jenkinsci.remoting.protocol.NetworkLayer.onRead(NetworkLayer.java:136)
            at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$2200(BIONetworkLayer.java:48)
            at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:283)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
            at java.lang.Thread.run(Thread.java:748)
            Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection to jenkins-server/10.20.30.35:40003
                    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1788)
                    at hudson.remoting.Request.call(Request.java:202)
                    at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:288)
                    at com.sun.proxy.$Proxy5.fetch3(Unknown Source)
                    at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:211)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
                    at jenkins.agents.AgentComputerUtil.getChannelToMaster(AgentComputerUtil.java:48)
                    at hudson.util.ProcessTree.get(ProcessTree.java:432)
                    at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1100)
                    at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1091)
                    at hudson.remoting.UserRequest.perform(UserRequest.java:211)
                    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
                    at hudson.remoting.Request$2.run(Request.java:369)
                    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
                    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                    ... 4 more
    Caused by: hudson.remoting.ChannelClosedException: Channel "unknown": Protocol stack cannot write data anymore. It is not open for write
            at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer$ByteBufferCommandTransport.write(ChannelApplicationLayer.java:305)
            at hudson.remoting.AbstractByteBufferCommandTransport.write(AbstractByteBufferCommandTransport.java:304)
            at hudson.remoting.Channel.send(Channel.java:764)
            at hudson.remoting.Channel.close(Channel.java:1479)
            ... 18 more
    
    Dec 05, 2020 5:41:21 AM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Terminated
    Dec 05, 2020 5:41:21 AM hudson.util.ProcessTree get
    WARNING: Failed to load winp. Reverting to the default
    java.lang.NoClassDefFoundError: hudson/util/ProcessTree$Linux$LinuxProcess
            at hudson.util.ProcessTree.get(ProcessTree.java:451)
            at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1100)
            at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1091)
            at hudson.remoting.UserRequest.perform(UserRequest.java:211)
            at hudson.remoting.UserRequest.perform(UserRequest.java:54)
            at hudson.remoting.Request$2.run(Request.java:369)
            at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
            at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.ClassNotFoundException: hudson.util.ProcessTree$Linux$LinuxProcess
            at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
            at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:173)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
            ... 12 more
    
    Dec 05, 2020 5:41:21 AM hudson.remoting.Request$2 run
    INFO: Failed to send back a reply to the request hudson.remoting.Request$2@1affe1cf: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@157a1c18:JNLP4-connect connection to jenkins-server/10.20.30.35:40003": channel is already closed
    

    openjdk version "1.8.0_272" 安装在( Jenkins master, K8s Master and K8s-Worker )系统也重新启动了所有三个系统,但仍然没有成功。

    我希望这个音量能安装在我的播客里,我已经试过了 K8s v1.19.4 Kubernetes Jenkins Plugin - 1.27.0 .不确定是什么原因导致 CentOS-7.9 .而同样的方法在 CentOS - 8.2.2004 (Core) & 4.18.0-193.14.2.el8_2.x86_64 K8s主机本机操作系统的内核。

    1 回复  |  直到 4 年前
        1
  •  0
  •   user4948798    4 年前

    我已经升级了我的docker形象 Ubuntu 16.04.6 LTS - 3.10.0-1160.6.1.el7.x86_64 Ubuntu 16.04.7 to 3.10.0-1160.6.1.el7.x86_64 还是没用。但似乎 Kubernetes on CentOS-7.9 & with Kernal-3.10.0-1160.6.1.el7.x86_64 存在内核特定的问题。因此,我已将本机主机的操作系统升级为 CentOS-8.2 with - 4.18.0-193.28.1.el8_2.x86_64 内核,现在我的管道构建工作正常。