【发布时间】:2021-01-24 04:28:32
【问题描述】:
我无法解决我在初学者教程中遇到的问题。当我尝试从 Jenkins 仅在 Kubernetes 上创建部署时,我收到了错误消息。
根据我的研究,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 插件。我不知道我该怎么做?
我该如何解决这个问题?谁能帮帮我?
错误
Starting Kubernetes deployment
Loading configuration: /var/lib/jenkins/workspace/k8sdeploy/k8sdeploy.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
^
我的管道
pipeline {
agent any
stages {
stage('Clone App from Github') {
steps {
git credentialsId: 'github', url: 'https://github.com/eneslanpir/k8sdeploy'
}
}
stage("Wait For 5 Seconds"){
steps {
sleep 5
}
}
stage("Kubernetes Create Deployment"){
steps{
script {
kubernetesDeploy(configs: "k8sdeploy.yml", kubeconfigId: "kubeconfig")
}
}
}
}
}
我来自 Github 的部署 yaml(已测试 - 在 Kuberentes 上工作)
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-jenkins
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-jenkins
image: nginx:1.16.1
ports:
- containerPort: 80
当降级到 Jackson 2 API v2.10.0 时,一切都出错了。
【问题讨论】:
标签: javascript html css jenkins kubernetes