<p>I'm building a CD pipeline using Jenkins on the Google Kubernetes Engine and I'm running into problems on the first build. As shown in the output below, the pipelined stages are being skipped &quot;due to earlier failure(s)&quot; which I am unable to identity.</p>
<p>I'm very new to Jenkins so would appreciate any help.
I've also pasted the Jenkinsfile below.</p>
<p>OUTPUT</p>
<pre><code>Started by user unknown or anonymous
 &gt; /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Setting origin to https://source.developers.google.com/p/org-footprint/r/gceme
 &gt; /usr/bin/git config remote.origin.url https://source.developers.google.com/p/org-footprint/r/gceme # timeout=10
Fetching origin...
Fetching upstream changes from origin
 &gt; /usr/bin/git --version # timeout=10
 &gt; git --version # 'git version 2.11.0'
 &gt; /usr/bin/git config --get remote.origin.url # timeout=10
using GIT_ASKPASS to set credentials org-footprint
 &gt; /usr/bin/git fetch --tags --progress -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/canary
Seen branch in repository origin/master
Seen 2 remote branches
Obtained Jenkinsfile from 45c2a3ac2fd7ec86e94d502c2f44aef083cbd7f1
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/sample-app_canary
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential source:org-footprint
 &gt; /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 &gt; /usr/bin/git config remote.origin.url https://source.developers.google.com/p/org-footprint/r/gceme # timeout=10
Fetching without tags
Fetching upstream changes from https://source.developers.google.com/p/org-footprint/r/gceme
 &gt; /usr/bin/git --version # timeout=10
 &gt; git --version # 'git version 2.11.0'
using GIT_ASKPASS to set credentials org-footprint
 &gt; /usr/bin/git fetch --no-tags --progress -- https://source.developers.google.com/p/org-footprint/r/gceme +refs/heads/*:refs/remotes/origin/* # timeout=10
Checking out Revision 45c2a3ac2fd7ec86e94d502c2f44aef083cbd7f1 (canary)
 &gt; /usr/bin/git config core.sparsecheckout # timeout=10
 &gt; /usr/bin/git checkout -f 45c2a3ac2fd7ec86e94d502c2f44aef083cbd7f1 # timeout=10
Commit message: &quot;Version 6&quot;
First time build. Skipping changelog.
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] container
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build and push image with Container Builder)
Stage &quot;Build and push image with Container Builder&quot; skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy Canary)
Stage &quot;Deploy Canary&quot; skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy Production)
Stage &quot;Deploy Production&quot; skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy Dev)
Stage &quot;Deploy Dev&quot; skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: Node is not a Kubernetes node: 
Finished: FAILURE
</code></pre>
<p>JENKINSFILE</p>
<pre><code>pipeline {

  environment {
    PROJECT = &quot;REPLACE_WITH_YOUR_PROJECT_ID&quot;
    APP_NAME = &quot;gceme&quot;
    FE_SVC_NAME = &quot;${APP_NAME}-frontend&quot;
    CLUSTER = &quot;jenkins-cd&quot;
    CLUSTER_ZONE = &quot;us-east1-d&quot;
    IMAGE_TAG = &quot;gcr.io/${PROJECT}/${APP_NAME}:${env.BRANCH_NAME}.${env.BUILD_NUMBER}&quot;
    JENKINS_CRED = &quot;${PROJECT}&quot;
  }

  agent {
    kubernetes {
      label 'sample-app'
      defaultContainer 'jnlp'
      yaml &quot;&quot;&quot;
apiVersion: v1
kind: Pod
metadata:
labels:
  component: ci
spec:
  # Use service account that can deploy to all namespaces
  serviceAccountName: cd-jenkins
  containers:
  - name: golang
    image: golang:1.10
    command:
    - cat
    tty: true
  - name: gcloud
    image: gcr.io/cloud-builders/gcloud
    command:
    - cat
    tty: true
  - name: kubectl
    image: gcr.io/cloud-builders/kubectl
    command:
    - cat
    tty: true
&quot;&quot;&quot;
}
  }
  stages {
    stage('Test') {
      steps {
        container('golang') {
          sh &quot;&quot;&quot;
            ln -s `pwd` /go/src/sample-app
            cd /go/src/sample-app
            go test
          &quot;&quot;&quot;
        }
      }
    }
    stage('Build and push image with Container Builder') {
      steps {
        container('gcloud') {
          sh &quot;PYTHONUNBUFFERED=1 gcloud builds submit -t ${IMAGE_TAG} .&quot;
        }
      }
    }
    stage('Deploy Canary') {
      // Canary branch
      when { branch 'canary' }
      steps {
        container('kubectl') {
          // Change deployed image in canary to the one we just built
          sh(&quot;sed -i.bak 's#gcr.io/cloud-solutions-images/gceme:1.0.0#${IMAGE_TAG}#' ./k8s/canary/*.yaml&quot;)
          step([$class: 'KubernetesEngineBuilder', namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/services', credentialsId: env.JENKINS_CRED, verifyDeployments: false])
          step([$class: 'KubernetesEngineBuilder', namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/canary', credentialsId: env.JENKINS_CRED, verifyDeployments: true])
          sh(&quot;echo http://`kubectl --namespace=production get service/${FE_SVC_NAME} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'` &gt; ${FE_SVC_NAME}&quot;)
        }
      }
    }
    stage('Deploy Production') {
      // Production branch
      when { branch 'master' }
      steps{
        container('kubectl') {
        // Change deployed image in canary to the one we just built
          sh(&quot;sed -i.bak 's#gcr.io/cloud-solutions-images/gceme:1.0.0#${IMAGE_TAG}#' ./k8s/production/*.yaml&quot;)
          step([$class: 'KubernetesEngineBuilder', namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/services', credentialsId: env.JENKINS_CRED, verifyDeployments: false])
          step([$class: 'KubernetesEngineBuilder', namespace:'production', projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/production', credentialsId: env.JENKINS_CRED, verifyDeployments: true])
          sh(&quot;echo http://`kubectl --namespace=production get service/${FE_SVC_NAME} -o jsonpath='{.status.loadBalancer.ingress[0].ip}'` &gt; ${FE_SVC_NAME}&quot;)
        }
      }
    }
    stage('Deploy Dev') {
      // Developer Branches
      when {
        not { branch 'master' }
        not { branch 'canary' }
      }
      steps {
        container('kubectl') {
          // Create namespace if it doesn't exist
          sh(&quot;kubectl get ns ${env.BRANCH_NAME} || kubectl create ns ${env.BRANCH_NAME}&quot;)
          // Don't use public load balancing for development branches
          sh(&quot;sed -i.bak 's#LoadBalancer#ClusterIP#' ./k8s/services/frontend.yaml&quot;)
          sh(&quot;sed -i.bak 's#gcr.io/cloud-solutions-images/gceme:1.0.0#${IMAGE_TAG}#' ./k8s/dev/*.yaml&quot;)
          step([$class: 'KubernetesEngineBuilder', namespace: &quot;${env.BRANCH_NAME}&quot;, projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/services', credentialsId: env.JENKINS_CRED, verifyDeployments: false])
          step([$class: 'KubernetesEngineBuilder', namespace: &quot;${env.BRANCH_NAME}&quot;, projectId: env.PROJECT, clusterName: env.CLUSTER, zone: env.CLUSTER_ZONE, manifestPattern: 'k8s/dev', credentialsId: env.JENKINS_CRED, verifyDeployments: true])
          echo 'To access your environment run `kubectl proxy`'
          echo &quot;Then access your service via http://localhost:8001/api/v1/proxy/namespaces/${env.BRANCH_NAME}/services/${FE_SVC_NAME}:80/&quot;
        }
      }
    }
  }
}
</code></pre>

<p>Plainly at the bottom of the log is the message:</p>
<p><code>ERROR: Node is not a Kubernetes node:</code></p>
<p>The pipeline is failing to launch the kubernetes agent because the master (according to the log: &quot;Running on Jenkins in /var/jenkins_home/workspace/sample-app_canary&quot;) is not in the kubernetes cluster that's been set up in the Manage Clouds section in Jenkins.</p>
