KubeSphere 版本3.1.0。
流水线部署,代码拉取,编译都是正常,最后使用kubernetesDeploy发布到k8s时候报错。直接使用kubectl
部署是可以正常部署。
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: saas
labels:
app: assassin-store
version: v1
name: assassin-store-v1
spec:
progressDeadlineSeconds: 600
replicas: 1
selector:
matchLabels:
app: assassin-store
version: v1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
template:
metadata:
labels:
app: assassin-store
version: v1
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
imagePullSecrets:
- name: aliyun-registry-secret
containers:
- name: assassin-aaehw2
image: $REGISTRY/$DOCKER_REGISTRY_NAMESPACE/$PROJECT_NAME:latest
args:
- --spring.profiles.active=prod
ports:
- name: tcp-9156
containerPort: 9156
protocol: TCP
resources:
limits:
cpu: 1000m
memory: 2048Mi
requests:
cpu: 100m
memory: 512Mi
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
serviceAccount: default
dnsPolicy: ClusterFirst
restartPolicy: Always
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: assassin-store
version: v1
topologyKey: kubernetes.io/hostname
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
namespace: saas
labels:
version: v1
app: assassin-store
name: assassin-store
spec:
ports:
- name: tcp-9156
port: 9156
protocol: TCP
targetPort: 9156
selector:
app: assassin-store
template:
metadata:
labels:
version: v1
app: assassin-store
sessionAffinity: None
type: ClusterIP
Starting Kubernetes deployment
ERROR: ERROR: Cannot create property=spec for JavaBean=class V1Service {
apiVersion: v1
kind: Service
metadata: class V1ObjectMeta {
annotations: null
clusterName: null
creationTimestamp: null
deletionGracePeriodSeconds: null
deletionTimestamp: null
finalizers: null
generateName: null
generation: null
initializers: null
labels: {version=v1, app=assassin-store}
managedFields: null
name: assassin-store
namespace: saas
ownerReferences: null
resourceVersion: null
selfLink: null
uid: null
}
spec: null
status: null
}
in 'reader', line 1, column 1:
apiVersion: v1
^
Cannot create property=template for JavaBean=class V1ServiceSpec {
clusterIP: null
externalIPs: null
externalName: null
externalTrafficPolicy: null
healthCheckNodePort: null
loadBalancerIP: null
loadBalancerSourceRanges: null
ports: [class V1ServicePort {
name: tcp-9156
nodePort: null
port: 9156
protocol: TCP
targetPort: 9156
}]
publishNotReadyAddresses: null
selector: {app=assassin-store}
sessionAffinity: null
sessionAffinityConfig: null
type: null
}
in 'reader', line 10, column 3:
ports:
^
Unable to find property 'template' on class: io.kubernetes.client.openapi.models.V1ServiceSpec
in 'reader', line 18, column 5:
metadata:
^
in 'reader', line 10, column 3:
ports:
^
hudson.remoting.ProxyException: Cannot create property=spec for JavaBean=class V1Service {
apiVersion: v1
kind: Service
metadata: class V1ObjectMeta {
annotations: null
clusterName: null
creationTimestamp: null
deletionGracePeriodSeconds: null
deletionTimestamp: null
finalizers: null
generateName: null
generation: null
initializers: null
labels: {version=v1, app=assassin-store}
managedFields: null
name: assassin-store
namespace: saas
ownerReferences: null
resourceVersion: null
selfLink: null
uid: null
}
spec: null
status: null
}
in 'reader', line 1, column 1:
apiVersion: v1
^
Cannot create property=template for JavaBean=class V1ServiceSpec {
clusterIP: null
externalIPs: null
externalName: null
externalTrafficPolicy: null
healthCheckNodePort: null
loadBalancerIP: null
loadBalancerSourceRanges: null
ports: [class V1ServicePort {
name: tcp-9156
nodePort: null
port: 9156
protocol: TCP
targetPort: 9156
}]
publishNotReadyAddresses: null
selector: {app=assassin-store}
sessionAffinity: null
sessionAffinityConfig: null
type: null
}
in 'reader', line 10, column 3:
ports:
^
Unable to find property 'template' on class: io.kubernetes.client.openapi.models.V1ServiceSpec
in 'reader', line 18, column 5:
metadata:
^
in 'reader', line 10, column 3:
ports:
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:290)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:171)
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331)
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.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
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 hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
at java.lang.Thread.run(Thread.java:748)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.233.73.150/10.233.73.150:44034
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
at hudson.remoting.Channel.call(Channel.java:1001)
at hudson.FilePath.act(FilePath.java:1160)
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)
... 1 more
Caused by: hudson.remoting.ProxyException: Cannot create property=template for JavaBean=class V1ServiceSpec {
clusterIP: null
externalIPs: null
externalName: null
externalTrafficPolicy: null
healthCheckNodePort: null
loadBalancerIP: null
loadBalancerSourceRanges: null
ports: [class V1ServicePort {
name: tcp-9156
nodePort: null
port: 9156
protocol: TCP
targetPort: 9156
}]
publishNotReadyAddresses: null
selector: {app=assassin-store}
sessionAffinity: null
sessionAffinityConfig: null
type: null
}
in 'reader', line 10, column 3:
ports:
^
Unable to find property 'template' on class: io.kubernetes.client.openapi.models.V1ServiceSpec
in 'reader', line 18, column 5:
metadata:
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:290)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:171)
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.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:267)
... 25 more
Caused by: hudson.remoting.ProxyException: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'template' on class: io.kubernetes.client.openapi.models.V1ServiceSpec
at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:158)
at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:148)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.getProperty(Constructor.java:309)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:230)
... 30 more
Loading configuration: /home/jenkins/agent/workspace/evopsjk82v_assassin-store_master/store-service/deploy/devops-deploy.yaml
Kubernetes deployment ended with HasError