Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53757

Exec Failure: Expected HTTP 101 response but was '403 Forbidden'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • kubernetes-plugin
    • None

      I have a bare-metal Jenkins master (v2.141, running kubernetes-plugin v1.12.6) and a bare-metal Kubernetes cluster (v1.11.0). I'm trying to run a simplified version of the multi-container example described in the "Container Group Support" section of the README.

      My Jenkinsfile is as follows:

      def label = "pod-${env.JOB_NAME}-${env.BUILD_NUMBER}".replace('_', '-').replace('/', '-')
      
      podTemplate(label: label, cloud: 'kubernetes2', namespace: 'default',
          containers: [
              containerTemplate(name: 'maven', image: 'maven:3.5-jdk-8-alpine', ttyEnabled: true, command: 'cat')
          ])
      {   
         node(label) {
            echo "#1"
            stage('Fetch Maven') {
               git 'https://github.com/jenkinsci/kubernetes-plugin.git'
               echo "#2"
               container('maven') {
                  stage ('Build Maven') {
                     echo "#3"
                     sh 'mvn -B clean install'
                  }
               }
            }
         }
      }
      

      Everything seems copacetic until the `sh` command in the final stage. Log fragment:

      [Pipeline] stage
      [Pipeline] { (Build Maven)
      [Pipeline] echo
      #3
      [Pipeline] sh
      [experimental_pipeline_k8s] Running shell script
      java.net.ProtocolException: Expected HTTP 101 response but was '403 Forbidden'
      	at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:219)
      	at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:186)
      	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
      	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

       

      I've set up a Kubernetes-specific log recorder on the master and it's not capturing anything untoward – the pod appears to be starting and terminating properly.

      Any thoughts?

            Unassigned Unassigned
            centerfire Brett Cashman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: