Kubernetes Continuous Deploy Plugin having issues

Viewed 1659

I am getting below error while intergrating Kubernetes with Jenkins using Kubernetes Continuous Deploy Plugin.

This is plugin worked till Jenkins Version 2.190.3 but after upgrading jenkins its started giving below error.

Below error looks like issue with Yaml file but the yaml file working fine when I executed manually.

Even I am not able to downgrade the kubernetes version.

Jenkins Version : 2.235.2
Kubernetes Continuous Deploy Plugin : 2.3.0
13:19:19 Starting Kubernetes deployment
13:19:19 Loading configuration: /var/jenkins_home/workspace/bom_sso/bom_rs_deployment.yaml
13:19:19 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
13:19:19 in 'reader', line 1, column 1:
13:19:19 apiVersion: apps/v1
13:19:19 ^
13:19:19
13:19:19 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
13:19:19 in 'reader', line 1, column 1:
13:19:19 apiVersion: apps/v1
13:19:19 ^
13:19:19
13:19:19 at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:336)
13:19:19 at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)

Thanks,

2 Answers

The issue you described is discussing in the ERROR: ERROR: java.lang.RuntimeException: io.kubernetes.client.openapi.ApiException: Not Found #122 github and still non-resolved.

This is very actual for everyone who use Jenkins Version : 2.235.1 +, not sure about 2.190.3

There are no fixes yet, however there is 1 workaround, maybe in will help you

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.

In order to force downgrade those 2 plugins, you can manually delete them from the plugins folder and upload the HPI files directly to Jenkins. Make sure you upload the correct versions as listed above.

This is an ugly workaround, by no means this should be considered a "fix".

  1. Downgrade plugins version

Jackson 2 API v2.10.0,

Kubernetes v1.21.3,

Kubernetes Client API v4.6.3-1,

Kubernetes Continuous Deploy v2.1.2,

Kubernetes Credentials v0.5.0

2)Check dns working properly (very important) 2a)Revise settings, customize as needed

kubectl edit cm coredns -n kube-system
apiVersion: v1
data:
  Corefile: |
    eureka cluster.local:53 {
        errors
        health {
           lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        prometheus :9153
        forward . /etc/resolv.conf
        cache 30
        loop
        reload
        loadbalance
    }
    .:53 {
        errors
        health {
           lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        prometheus :9153
        forward . 8.8.8.8
        cache 30
        loop
        reload
        loadbalance
    }
kind: ConfigMap
metadata:
  creationTimestamp: "2020-07-24T21:09:19Z"
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:data: {}
    manager: kubeadm
    operation: Update
    time: "2020-07-24T21:09:19Z"
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:data:
        f:Corefile: {}
    manager: kubectl
    operation: Update
    time: "2020-07-27T05:30:57Z"
  name: coredns
  namespace: kube-system
  resourceVersion: "952988"
  selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
  uid: 5a7fc41c-01a7-480a-89bd-82ab3070401c

2b)Then restart dns

kubectl get pods -n kube-system -oname |grep coredns |xargs kubectl delete -n kube-system

Hope that will help you

Thanks VKR,

But luckily it fixed in the Jenkins 2.235.3 version.

Below are the configuration I have.

Jenkins version : 2.235.3

Thanks,

Related