Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.kubernetes.client.openapi.models.V1Deployment Class not found exception #134

Open
kellycampbell opened this issue Jul 1, 2020 · 41 comments

Comments

@kellycampbell
Copy link

This seems to have started after a kubernetes 1.16 -> 1.17 cluster upgrade. We don't have a lot of jobs using this cd plugin yet, so we didn't notice right away.

19:14:55  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
19:14:55   in 'reader', line 1, column 1:
19:14:55      apiVersion: apps/v1

The class file exists, and there doesn't seem to be another plugin which has an older version of the kubernetes client jar.

$ find plugins -name \*.jar -print | while read i; do jar -tf "$i" | grep -q io.kubernetes.client.openapi.models && echo "$i" ; done
plugins/kubernetes-cd/WEB-INF/lib/client-java-api-7.0.0.jar
$ jar -tf plugins/kubernetes-cd/WEB-INF/lib/client-java-api-7.0.0.jar | grep io.kubernetes.client.openapi.models.V1Deployment
io/kubernetes/client/openapi/models/V1Deployment.class
io/kubernetes/client/openapi/models/V1DeploymentBuilder.class
io/kubernetes/client/openapi/models/V1DeploymentCondition.class
...

Full Error:

19:14:51  Starting Kubernetes deployment
19:14:55  Loading configuration: /var/lib/jenkins/workspace/internal-api-docs/docs/internal_api/deployment.yaml
19:14:55  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
19:14:55   in 'reader', line 1, column 1:
19:14:55      apiVersion: apps/v1
19:14:55      ^
19:14:55  
19:14:55  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
19:14:55   in 'reader', line 1, column 1:
19:14:55      apiVersion: apps/v1
19:14:55      ^
19:14:55  
19:14:55  	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:336)
19:14:55  	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
19:14:55  	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219)
19:14:55  	at io.kubernetes.client.util.Yaml$CustomConstructor.constructObject(Yaml.java:337)
19:14:55  	at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173)
19:14:55  	at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157)
19:14:55  	at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:472)
19:14:55  	at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:438)
19:14:55  	at io.kubernetes.client.util.Yaml.loadAs(Yaml.java:224)
19:14:55  	at io.kubernetes.client.util.Yaml.modelMapper(Yaml.java:494)
19:14:55  	at io.kubernetes.client.util.Yaml.loadAll(Yaml.java:272)
19:14:55  	at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:236)
19:14:55  	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:172)
19:14:55  	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
19:14:55  	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
19:14:55  	at hudson.FilePath.act(FilePath.java:1162)
19:14:55  	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
19:14:55  	at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
19:14:55  	at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
19:14:55  	at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
19:14:55  	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
19:14:55  	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
19:14:55  	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
19:14:55  	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
19:14:55  	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
19:14:55  	at java.lang.Thread.run(Thread.java:748)
19:14:55  Caused by: hudson.remoting.ProxyException: org.yaml.snakeyaml.error.YAMLException: Class not found: io.kubernetes.client.openapi.models.V1Deployment
19:14:55  	at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:664)
19:14:55  	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322)
19:14:55  	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331)
19:14:55  	... 30 more
@Bayron8
Copy link

Bayron8 commented Jul 3, 2020

I Have a similar problem, after I updated my AKS cluster from 1.14 to 1.15.

Full error

`Starting Azure Container Service / Kubernetes Service Deployment
Loading configuration: /var/jenkins_home/workspace/zurich-eva-broker_qa/target/zurich-broker-qa.yaml
Delete Kubernetes management config file /var/jenkins_home/workspace/zurich-eva-broker_qa/kubeconfig-4398355906621090155
ERROR: ERROR: Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1ConfigMap; exception=Class not found: io.kubernetes.client.openapi.models.V1ConfigMap
 in 'reader', line 1, column 1:
    apiVersion: v1
    ^

Can't construct a java object for tag:yaml.org,2002:io.kubernetes.client.openapi.models.V1ConfigMap; exception=Class not found: io.kubernetes.client.openapi.models.V1ConfigMap
 in 'reader', line 1, column 1:
    apiVersion: 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.acs.commands.KubernetesDeploymentCommandBase$KubernetesDeployWorker.call(KubernetesDeploymentCommandBase.java:194)
	at com.microsoft.jenkins.acs.commands.KubernetesDeploymentCommandBase$KubernetesDeployWorker.call(KubernetesDeploymentCommandBase.java:132)
	at hudson.FilePath.act(FilePath.java:1162)
	at com.microsoft.jenkins.acs.commands.KubernetesDeploymentCommandBase.doExecute(KubernetesDeploymentCommandBase.java:78)
	at com.microsoft.jenkins.acs.commands.AKSDeploymentCommand.execute(AKSDeploymentCommand.java:32)
	at com.microsoft.jenkins.acs.commands.AKSDeploymentCommand.execute(AKSDeploymentCommand.java:20)
	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.acs.ACSDeploymentBuilder.perform(ACSDeploymentBuilder.java:56)
	at com.microsoft.jenkins.acs.ACSDeploymentContext$ExecutionImpl.run(ACSDeploymentContext.java:141)
	at com.microsoft.jenkins.acs.ACSDeploymentContext$ExecutionImpl.run(ACSDeploymentContext.java:125)
	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: org.yaml.snakeyaml.error.YAMLException: Class not found: io.kubernetes.client.openapi.models.V1ConfigMap
	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`

Captura de Pantalla 2020-07-03 a la(s) 6 31 55 p  m

@wfee
Copy link

wfee commented Jul 7, 2020

Experiencing the same problem...

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

@jacampano
Copy link

Experiencing the same problem:

Starting Kubernetes deployment
Prepare Docker container registry secrets with name: citaprevia-secrets-tmp
Created V1Secret: name: citaprevia-secrets-tmp
Inject environment variable KUBERNETES_SECRET_NAME=citaprevia-secrets-tmp
Loading configuration: /integracion_continua/jenkins2/workspace/CitaPrevia/citaprevia.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

@renedare
Copy link

I have the same problem running Kubernetes v1.18.3. I'm running Jenkins v2.235.1 and all my plugins are up to date.

The workaround I've found for now is to downgrade Jackson 2 API to v2.10.3 and to downgrade Snakeyaml API to v1.26.2. If those 2 plugins are updated to their respective latest versions, the error message comes back.

@Bayron8
Copy link

Bayron8 commented Jul 28, 2020

I have the same problem running Kubernetes v1.18.3. I'm running Jenkins v2.235.1 and all my plugins are up to date.

The workaround I've found for now is to downgrade Jackson 2 API to v2.10.3 and to downgrade Snakeyaml API to v1.26.2. If those 2 plugins are updated to their respective latest versions, the error message comes back.

It worked for me too, I downgraded manually those plugins versions and the pipeline run successfully!

Thanks!

@Danepic
Copy link

Danepic commented Aug 10, 2020

Any another workaround?

@eliskvitka
Copy link

eliskvitka commented Sep 1, 2020

Downgrading plugins worked for me too.
I'm running clean Jenkins v2.254 with recommended plugins and latest Kubernetes Continuous Deploy Plugin (2.3.0) and have same error.
After downgrading:

  • Jackson 2 API 2.11.2 -> 2.10.3
  • Snakeyaml API 1.26.4 -> 1.26.3
  • Kubernetes Client API 4.9.2-2 -> 4.9.2-1
  • Kubernetes Credentials 0.7.0 -> 0.6.2

all works fine!
Also, i downgraded ECharts API and JUnit, but this plugins not required for kubernetes cd.
Thanks

@bill23-kim
Copy link

this issue been resolved?
in 2.1.2 version change log, it is written as below.

Fix ClassNotFoundException for jackson lib

luigidifraia added a commit to luigidifraia/k8s-distributed-example that referenced this issue Sep 17, 2020
@rahulwagh
Copy link

I downgraded the -

  1. Jackson 2 API ->2.10.3
  2. Snakeyaml API -> 1.26.3

But after downgrade now I am stuck with following error (any inputs will be highly appreciated)

Starting Kubernetes deployment
Loading configuration: /var/jenkins_home/workspace/test/spring-boot.yml
ERROR: ERROR: Cannot create property=spec for JavaBean=class V1Deployment {
    apiVersion: apps/v1
    kind: Deployment
    metadata: class V1ObjectMeta {
        annotations: null
        clusterName: null
        creationTimestamp: null
        deletionGracePeriodSeconds: null
        deletionTimestamp: null
        finalizers: null
        generateName: null
        generation: null
        initializers: null
        labels: {name=jhooq-pod-with-pvc}
        managedFields: null
        name: jhooq-pod-with-pvc
        namespace: null
        ownerReferences: null
        resourceVersion: null
        selfLink: null
        uid: null
    }
    spec: null
    status: null
}
 in 'reader', line 1, column 1:
    apiVersion: apps/v1
    ^
Cannot create property=containers for JavaBean=class V1DeploymentSpec {
    minReadySeconds: null
    paused: null
    progressDeadlineSeconds: null
    replicas: null
    revisionHistoryLimit: null
    selector: null
    strategy: null
    template: null
}
 in 'reader', line 8, column 3:
      containers:
      ^
Unable to find property 'containers' on class: io.kubernetes.client.openapi.models.V1DeploymentSpec
 in 'reader', line 9, column 3:
      - name: jhooq-pod-with-pvc
      ^

 in 'reader', line 8, column 3:
      containers:
      ^

hudson.remoting.ProxyException: Cannot create property=spec for JavaBean=class V1Deployment {
    apiVersion: apps/v1
    kind: Deployment
    metadata: class V1ObjectMeta {
        annotations: null
        clusterName: null
        creationTimestamp: null
        deletionGracePeriodSeconds: null
        deletionTimestamp: null
        finalizers: null
        generateName: null
        generation: null
        initializers: null
        labels: {name=jhooq-pod-with-pvc}
        managedFields: null
        name: jhooq-pod-with-pvc
        namespace: null
        ownerReferences: null
        resourceVersion: null
        selfLink: null
        uid: null
    }
    spec: null
    status: null
}
 in 'reader', line 1, column 1:
    apiVersion: apps/v1
    ^

@renedare
Copy link

I downgraded the -

  1. Jackson 2 API ->2.10.3
  2. Snakeyaml API -> 1.26.3

But after downgrade now I am stuck with following error (any inputs will be highly appreciated)

Starting Kubernetes deployment
Loading configuration: /var/jenkins_home/workspace/test/spring-boot.yml
ERROR: ERROR: Cannot create property=spec for JavaBean=class V1Deployment {
    apiVersion: apps/v1
    kind: Deployment
    metadata: class V1ObjectMeta {
        annotations: null
        clusterName: null
        creationTimestamp: null
        deletionGracePeriodSeconds: null
        deletionTimestamp: null
        finalizers: null
        generateName: null
        generation: null
        initializers: null
        labels: {name=jhooq-pod-with-pvc}
        managedFields: null
        name: jhooq-pod-with-pvc
        namespace: null
        ownerReferences: null
        resourceVersion: null
        selfLink: null
        uid: null
    }
    spec: null
    status: null
}
 in 'reader', line 1, column 1:
    apiVersion: apps/v1
    ^
Cannot create property=containers for JavaBean=class V1DeploymentSpec {
    minReadySeconds: null
    paused: null
    progressDeadlineSeconds: null
    replicas: null
    revisionHistoryLimit: null
    selector: null
    strategy: null
    template: null
}
 in 'reader', line 8, column 3:
      containers:
      ^
Unable to find property 'containers' on class: io.kubernetes.client.openapi.models.V1DeploymentSpec
 in 'reader', line 9, column 3:
      - name: jhooq-pod-with-pvc
      ^

 in 'reader', line 8, column 3:
      containers:
      ^

hudson.remoting.ProxyException: Cannot create property=spec for JavaBean=class V1Deployment {
    apiVersion: apps/v1
    kind: Deployment
    metadata: class V1ObjectMeta {
        annotations: null
        clusterName: null
        creationTimestamp: null
        deletionGracePeriodSeconds: null
        deletionTimestamp: null
        finalizers: null
        generateName: null
        generation: null
        initializers: null
        labels: {name=jhooq-pod-with-pvc}
        managedFields: null
        name: jhooq-pod-with-pvc
        namespace: null
        ownerReferences: null
        resourceVersion: null
        selfLink: null
        uid: null
    }
    spec: null
    status: null
}
 in 'reader', line 1, column 1:
    apiVersion: apps/v1
    ^

Try downgrading your Snakeyaml to 1.26.2.

I'm actually not sure which version of those 2 plugins introduced the breaking change, I roughly knew the date I had those installed for the first time and reverted to those versions.

@arundev4ops
Copy link

I have the same problem running Kubernetes v1.18.3. I'm running Jenkins v2.235.1 and all my plugins are up to date.

The workaround I've found for now is to downgrade Jackson 2 API to v2.10.3 and to downgrade Snakeyaml API to v1.26.2. If those 2 plugins are updated to their respective latest versions, the error message comes back.

Thanks. After all trail and errors , exact solution of yours worked for me.

@prydin
Copy link

prydin commented Dec 21, 2020

Has anyone been able to find the root cause for this? I'm the maintainer of another Jenkins plugin (vrealize-automation-8) that suffers from the exact same issue. I'd love to find a way to fix my code instead of having users downgrade plugins.
https://issues.jenkins.io/browse/JENKINS-64498

@apurvabhandari
Copy link

apurvabhandari commented Jan 9, 2021

Still same issue. Error mentioned below.
I tried with yml and yaml both facing same error. I have simple deployment manifest file(Kubernetes 1.18). Also tried downgrading and upgrading Jenkins but same error
Jenkins 2.263.1
Snakeyaml API Plugin : 1.27.0
Kubernetes Client API Plugin : 4.11.1
Jackson 2 API Plugin : 2.12.0
Kubernetes plugin : 1.28.5

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/my-new/Deployment.yml
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: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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
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

@xiangyu5945
Copy link

Still same issue. Error mentioned below.
I tried with yml and yaml both facing same error. I have simple deployment manifest file(Kubernetes 1.18). Also tried downgrading and upgrading Jenkins but same error
Jenkins 2.263.1 Snakeyaml API Plugin : 1.27.0 Kubernetes Client API Plugin : 4.11.1 Jackson 2 API Plugin : 2.12.0 Kubernetes plugin : 1.28.5

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/my-new/Deployment.yml
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: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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
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

hello ~
what is your os distribution ?
I have met the same issue, and I use docker jenkins with alphine as its os .

@apurvabhandari
Copy link

Still same issue. Error mentioned below.
I tried with yml and yaml both facing same error. I have simple deployment manifest file(Kubernetes 1.18). Also tried downgrading and upgrading Jenkins but same error
Jenkins 2.263.1 Snakeyaml API Plugin : 1.27.0 Kubernetes Client API Plugin : 4.11.1 Jackson 2 API Plugin : 2.12.0 Kubernetes plugin : 1.28.5

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/my-new/Deployment.yml
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: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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
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

hello ~
what is your os distribution ?
I have met the same issue, and I use docker jenkins with alphine as its os .

I am using Ubuntu. Standalone setup on ec2

NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"

@parlacom
Copy link

parlacom commented Jan 11, 2021

I'm still have the same issue, I'm using the latest version of Jenkins, and both plugins Kubernetes and Jakson.

This issue is happening for so long time, and downgrade Jakson mess up all Jenkins environment.

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: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)

@xiangyu5945
Copy link

Still same issue. Error mentioned below.
I tried with yml and yaml both facing same error. I have simple deployment manifest file(Kubernetes 1.18). Also tried downgrading and upgrading Jenkins but same error
Jenkins 2.263.1 Snakeyaml API Plugin : 1.27.0 Kubernetes Client API Plugin : 4.11.1 Jackson 2 API Plugin : 2.12.0 Kubernetes plugin : 1.28.5

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/my-new/Deployment.yml
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: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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
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

hello ~
what is your os distribution ?
I have met the same issue, and I use docker jenkins with alphine as its os .

I am using Ubuntu. Standalone setup on ec2

NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"

seems not related to os ,good news for me.
still not resolved ....

@apurvabhandari
Copy link

@allxiao @gavinfish

@duncanhkc
Copy link

duncanhkc commented Jan 18, 2021

I seem to face similar issues.

I'm using jenkins from docker image jenkins/jenkins:lts
Jenkins 2.263.2
Snakeyaml API Plugin: 1.27.0
Jackson 2 API Plugin: 2.12.1
Kubernetes Continuous Deploy Plugin: 2.3.1


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:
kind: Service
^

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:
kind: Service
^

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:1248)
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 jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.Build$BuildExecution.build(Build.java:197)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
at hudson.model.Run.execute(Run.java:1907)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)

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)
... 33 more
ERROR: Kubernetes deployment ended with HasError
Finished: FAILURE

@parlacom
Copy link

Any update ?

@gkhnsmsk
Copy link

I'm still have the same issue, I'm using the latest version of Jenkins, and both plugins Kubernetes and Jakson.

This issue is happening for so long time, and downgrade Jakson mess up all Jenkins environment.

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: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)

same here

@parlacom
Copy link

I've changed the plugin, I started to use this one https://plugins.jenkins.io/kubernetes-cli simple to integrate and works fine ;)

@gkhnsmsk
Copy link

can you maybe share your git repo so I can have a look into jenkinsfile?

@cardiff1982
Copy link

Are there any solutions for this issue?

@serhiiKalchenko
Copy link

serhiiKalchenko commented Mar 27, 2021

Jenkins 2.277.1
Kubernetes Continuous Deploy 2.3.1
Jackson 2 API 2.12.1
Snakeyaml API Plugin 1.27.0
Kubernetes Client API 4.13.2-1
Kubernetes Credentials 0.8.0
Kubernetes version 1.20:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5", GitCommit:"6b1d87acf3c8253c123756b9e61dac642678305f", GitTreeState:"clean", BuildDate:"2021-03-18T01:10:43Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5", GitCommit:"6b1d87acf3c8253c123756b9e61dac642678305f", GitTreeState:"clean", BuildDate:"2021-03-18T01:02:01Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"linux/amd64"}

Issue

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/spring-petclinic-kube_main/spring-petclinic-kube.yml
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:
    kind: Service
    ^

still the same trouble...((

@mahusanin
Copy link

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.

@eggsbenjamin
Copy link

Hey @braunly thanks for the solution!

Also, i downgraded ECharts API and JUnit, but this plugins not required for kubernetes cd.

Please could you also provide the versions of these plugins which you downgraded to? Cheers

@chrouzz
Copy link

chrouzz commented Apr 13, 2021

same problem, no fix yet?

@eliskvitka
Copy link

Hey @braunly thanks for the solution!

Also, i downgraded ECharts API and JUnit, but this plugins not required for kubernetes cd.

Please could you also provide the versions of these plugins which you downgraded to? Cheers

I've switched to Kubernetes-cli plugin. Build my own Jenkins docker image with kubectl installed and happy to use kubernetes without this error.
I don't remember exact versions, but you can try ECharts API Plugin 4.7.0-1 and JUnit 1.29. Maybe early.

For latest Jenkins (2.288) you need to downgrade a lot more plugins with many security fixes.
Stop using kubernetes-cd plugin. Use something else or write your own.

@aqua2021
Copy link

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.

Hey @mahusanin thanks for the solution
downgraded Kubernetes CD to version 1.0 and it worked perfect

@nguyenminh15988
Copy link

nguyenminh15988 commented May 8, 2021

ersion 1.0

hello @aqua2021 how to downgrade Kubernetes CD plugin to 1.0could you please guide me

@varun-vashishtha
Copy link

ersion 1.0

hello @aqua2021 how to downgrade Kubernetes CD plugin to 1.0could you please guide me

go to the manage plugin section , in advanced tab upload the 1.0 plugin .hpi file

@varun-vashishtha
Copy link

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.

worked for me , thanks

@nguyenminh15988
Copy link

hi @varun-vashishtha thanks for your response, could you please share me the 1.0 plugin hpi file?
my email: [email protected]
thank you very much

@varun-vashishtha
Copy link

Hi @nguyenminh15988 ,

Kindly hit this link to download version 1.0.0 .hpi file of Kubernetes cd plugin.

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

@nguyenminh15988
Copy link

Hi @nguyenminh15988 ,

Kindly hit this link to download version 1.0.0 .hpi file of Kubernetes cd plugin.

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

hi @varun-vashishtha thank you very much,
it worked for me.
have a nice day

@aceslup
Copy link

aceslup commented May 20, 2021

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.

it worked for me too.
thank you

@nurhun
Copy link

nurhun commented Jun 24, 2021

Using Jenkins 2.297 with v1.21.1+k3s1 cluster. Getting the same issue.

  • Tried to downgrade to v 1.0 using .hpi file, but got error: io.fabric8.kubernetes.client.kubernetesclientexception: an error has occurred. hudson.remoting.proxyexception: io.fabric8.kubernetes.client.kubernetesclientexception: an error has occurred.
  • Tried to downgrade Jackson 2 API & Snakeyaml API Plugin, Kubernetes Continuous Deploy plugin itself gone with many other plugins .. had to upgrade them again.

Any fix yet ?

@aleon1220
Copy link

Check this thread in StackOverflow https://stackoverflow.com/questions/62688901/class-not-found-io-kubernetes-client-openapi-models-v1service/68437162#68437162

The solution is just to downgrade the plugin Kubernetes Continuous Deploy to 1.0

@Nurmukhamed02
Copy link

I am going to deploy k8s deployment to EKS
I already downgraded kubernetes cd plugin to 1.0 but still I have another error. could someone help me

Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/Nurmukhamed/nginx.yaml
ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://30e77455a7ca459fff63a7e7f29f8a16.gr7.us-east-1.eks.amazonaws.com/apis/apps/v1/namespaces/default/deployments/nginx-deployment. Message: Forbidden! User arn:aws:eks:us-east-1:900628161353:cluster/eks doesn't have permission. deployments.apps "nginx-deployment" is forbidden: User "system:anonymous" cannot get resource "deployments" in API group "apps" in the namespace "default".
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://30e77455a7ca459fff63a7e7f29f8a16.gr7.us-east-1.eks.amazonaws.com/apis/apps/v1/namespaces/default/deployments/nginx-deployment. Message: Forbidden! User arn:aws:eks:us-east-1:900628161353:cluster/eks doesn't have permission. deployments.apps "nginx-deployment" is forbidden: User "system:anonymous" cannot get resource "deployments" in API group "apps" in the namespace "default".
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:472)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:409)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:381)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:344)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:313)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:296)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:794)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.getMandatory(BaseOperation.java:210)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:177)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$DeploymentUpdater.getCurrentResource(KubernetesClientWrapper.java:412)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$DeploymentUpdater.getCurrentResource(KubernetesClientWrapper.java:400)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper$ResourceUpdater.createOrApply(KubernetesClientWrapper.java:366)
at com.microsoft.jenkins.kubernetes.KubernetesClientWrapper.apply(KubernetesClientWrapper.java:159)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:168)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:122)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:105)
at hudson.FilePath.act(FilePath.java:1259)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:67)
at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:46)
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)

@emoxam
Copy link

emoxam commented Dec 1, 2022

It's bad the project is abandoned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests