<p>We are using <strong>Google kubernetes engine-plugin</strong>- 0.8.1 for Jenkins for deploying an app via yaml files, strangely we are getting java exceptions while our app is developed using python.
following is the detailed error message:</p>

<pre><code>java.lang.NullPointerException
    at com.google.jenkins.plugins.k8sengine.Manifests$ManifestObject.addLabel(Manifests.java:114)
    at com.google.jenkins.plugins.k8sengine.KubernetesEngineBuilder.addMetricsLabel(KubernetesEngineBuilder.java:303)
    at com.google.jenkins.plugins.k8sengine.KubernetesEngineBuilder.perform(KubernetesEngineBuilder.java:266)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    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 java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
</code></pre>

<p>Please note that building Docker image step and pushing it to DockerHub worked flawlessly as declared it in the jenkinsfile, following is my Jenkinsfile where the deployment to kubernetes cluster is happening.</p>

<pre><code>stage("Step 3: Deploy BUILT artifacts to K8"){
            steps{
                step([$class: 'KubernetesEngineBuilder', projectId: env.PROJECT_ID, clusterName: env.CLUSTER_NAME, location: env.LOCATION, manifestPattern: 'configmap-staging.yaml', credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])
                step([$class: 'KubernetesEngineBuilder', projectId: env.PROJECT_ID, clusterName: env.CLUSTER_NAME, location: env.LOCATION, manifestPattern: 'deployment.yaml', credentialsId: env.CREDENTIALS_ID, verifyDeployments: true])
            }
</code></pre>

<p>Any help is highly appreciated as this is the first time we started implementing CI/CD.</p>

cross_handle
<p>Not sure if you solved this. I ran into this problem before, check your YAML file.</p>
<p>I left one <code>---</code> at the end of my YAML file which causes Jenkins this type of error. Removing the last <code>---</code> cleared the error.</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  ...
spec:
  ...

---

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  ...
spec:
  ...

---  # &lt;-- remove it
</code></pre>
<p><strong>Note: when you do standalone &quot;kubectl apply ...&quot;, the trailing <code>---</code> will be ignored</strong></p>
