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

Pipeline Job fails exception=Class not found: io.kubernetes.client.openapi.models.V1Deployment

      I am getting the following error while running the deployment in kubernetes. 

       

      Starting Kubernetes deployment
      Loading configuration: /var/lib/jenkins/workspace/test-pipe2/myweb.yaml
      ERROR: ERROR: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Deployment; exception=Class not found: io.kubernetes.client.openapi.models.V1Deployment
       in 'reader', line 1, column 1:
          apiVersion: apps/v1
          ^
      
      hudson.remoting.ProxyException: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Deployment; exception=Class not found: io.kubernetes.client.openapi.models.V1Deployment
       in 'reader', line 1, column 1:
          apiVersion: apps/v1
          ^
      
      	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:336)
      	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
      	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219)
      	at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
      	at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173)
      	at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157)
      	at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:472)
      	at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:438)
      	at io.kubernetes.client.util.Yaml.loadAs(Yaml.java:224)
      	at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:494)
      	at io.kubernetes.client.util.Yaml.loadAll(Yaml.java:272)
      	at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:236)
      	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172)
      	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
      	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
      	at hudson.FilePath.act(FilePath.java:1162)
      	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
      	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
      	at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
      	at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
      	at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
      	at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
      	at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
      	at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
      	at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
      	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)
      Caused by: hudson.remoting.ProxyException: org.yaml.snakeyaml.error.YAMLException: Class not found: io.kubernetes.client.openapi.models.V1Deployment
      	at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:664)
      	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322)
      	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331)
      	... 30 more
      Kubernetes deployment ended with HasError
      

          [JENKINS-62954] Pipeline Job fails exception=Class not found: io.kubernetes.client.openapi.models.V1Deployment

          Febin K added a comment - - edited

          I have seen the other user reporting the same issue: https://stackoverflow.com/questions/62688901/class-not-found-io-kubernetes-client-openapi-models-v1service

          Version :

          Base OS- Centos 7

          Jenkins :  Core 2.235.1

          Kubernetes plugin: 1.26.2

          Kubernetes Continuous Deploy Plugin: 2.3.0

          Kubernetes cluster Version:

          Client Version: v1.17.8
          Server Version: v1.18.3

          Febin K added a comment - - edited I have seen the other user reporting the same issue:  https://stackoverflow.com/questions/62688901/class-not-found-io-kubernetes-client-openapi-models-v1service Version : Base OS- Centos 7 Jenkins :  Core 2.235.1 Kubernetes plugin: 1.26.2 Kubernetes Continuous Deploy Plugin: 2.3.0 Kubernetes cluster Version: Client Version: v1.17.8 Server Version: v1.18.3

          Febin K added a comment -

          This is not a bug. Job was executing on the master itself. The following step executed to resolve the issue. 

          To completely disable jobs from executing on the master and to solely utilize slave, the executors count on the master needs to be set to 0. This value is set on the Jenkins system configuration page which can be accessed by selecting Manage Jenkins on the lefthand size of the master landing page and selecting Configure System. Next to # of executors, enter 0 and then hit Save to apply the changes.

          Febin K added a comment - This is not a bug. Job was executing on the master itself. The following step executed to resolve the issue.  To completely disable jobs from executing on the master and to solely utilize slave, the executors count on the master needs to be set to 0. This value is set on the Jenkins system configuration page which can be accessed by selecting  Manage Jenkins  on the lefthand size of the master landing page and selecting  Configure System . Next to  # of executors , enter 0 and then hit  Save  to apply the changes.

          So, what if I'm executing Jenkins with no slave nodes at all? I'm using Jenkins on a Pod.

          I would not be able to use Jenkins to deploy on Kubernetes? 

          Is that the policy?

          Carlos Alvarado added a comment - So, what if I'm executing Jenkins with no slave nodes at all? I'm using Jenkins on a Pod. I would not be able to use Jenkins to deploy on Kubernetes?  Is that the policy?

          Reporter reported this as not being a defect.

          Vincent Latombe added a comment - Reporter reported this as not being a defect.

          Avinash added a comment - - edited

          Getting below error while running pipeline. Please provide a proper solution. I downgrade the plugins also still same issue.

           

          Starting Kubernetes deployment
          Loading configuration: /var/lib/jenkins/workspace/erp-bud-buyer/manifest.yaml
          ERROR: ERROR: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Service; exception=Class not found: io.kubernetes.client.openapi.models.V1Service
          in 'reader', line 1, column 1:
          apiVersion: apps/v1
          ^

          hudson.remoting.ProxyException: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Service; exception=Class not found: io.kubernetes.client.openapi.models.V1Service
          in 'reader', line 1, column 1:
          apiVersion: apps/v1
          ^

          at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:335)
          at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:229)
          at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219)
          at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
          at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173)
          at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157)
          at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:490)
          at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:456)
          at io.kubernetes.client.util.Yaml.loadAs(Yaml.java:224)
          at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:494)
          at io.kubernetes.client.util.Yaml.loadAll(Yaml.java:272)
          at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:236)
          at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172)
          at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
          at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
          at hudson.FilePath.act(FilePath.java:1163)
          at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
          at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
          at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
          at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
          at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
          at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
          at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
          at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
          at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
          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)
          Caused by: hudson.remoting.ProxyException: org.yaml.snakeyaml.error.YAMLException: Class not found: io.kubernetes.client.openapi.models.V1Service
          at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:664)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322)
          at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331)
          ... 30 more

          Avinash added a comment - - edited Getting below error while running pipeline. Please provide a proper solution. I downgrade the plugins also still same issue.   Starting Kubernetes deployment Loading configuration: /var/lib/jenkins/workspace/erp-bud-buyer/manifest.yaml ERROR: ERROR: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Service; exception=Class not found: io.kubernetes.client.openapi.models.V1Service in 'reader', line 1, column 1: apiVersion: apps/v1 ^ hudson.remoting.ProxyException: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1Service; exception=Class not found: io.kubernetes.client.openapi.models.V1Service in 'reader', line 1, column 1: apiVersion: apps/v1 ^ at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:335) at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:229) at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337) at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173) at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157) at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:490) at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:456) at io.kubernetes.client.util.Yaml.loadAs(Yaml.java:224) at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:494) at io.kubernetes.client.util.Yaml.loadAll(Yaml.java:272) at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:236) at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172) at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124) at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106) at hudson.FilePath.act(FilePath.java:1163) at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68) at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45) at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88) at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96) at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75) at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77) at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42) at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54) at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35) 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) Caused by: hudson.remoting.ProxyException: org.yaml.snakeyaml.error.YAMLException: Class not found: io.kubernetes.client.openapi.models.V1Service at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:664) at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322) at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ... 30 more

          Varun added a comment - - edited

          I have found the solution to this problem. I have tried many times and it's working perfectly. Kubernetes CD plugin should be Version 1.0. No need to downgrade other plugins.

          Kindly hit this [link|https://updates.jenkins.io/download/plugins/kubernetes-cd/1.0.0/kubernetes-cd.hpi] to download the version 1.0.0 .hpi file of the Kubernetes cd plugin from the official Jenkins plugin site.

          Reference - https://plugins.jenkins.io/kubernetes-cd/#releases

          Varun added a comment - - edited I have found the solution to this problem. I have tried many times and it's working perfectly. Kubernetes CD plugin should be Version 1.0. No need to downgrade other plugins. Kindly hit this [link| https://updates.jenkins.io/download/plugins/kubernetes-cd/1.0.0/kubernetes-cd.hpi ] to download the version 1.0.0 .hpi file of the Kubernetes cd plugin from the official Jenkins plugin site. Reference - https://plugins.jenkins.io/kubernetes-cd/#releases

            febi881 Febin K
            febi881 Febin K
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: