spring-cloud / spring-cloud-deployer-kubernetes

The Spring Cloud Deployer implementation for Kubernetes
Apache License 2.0
157 stars 98 forks source link

Error getting task logs for multiple containers #463

Closed szopal closed 2 years ago

szopal commented 2 years ago

We have run Spring Batch in GKE through SCDF and we use a sidecar container in this batch, so we have two container in pods. When I launch a task a try to get logs I get error in SCDF:

"a container name must be specified for pod task-3o8kogmxmg, choose one of"

I think that SCDF should get logs from both container.

jvalkeal commented 2 years ago

True, launching timestamp with:

deployer.timestamp.kubernetes.additional-containers=[{name: 'c2', image: 'busybox:1.26.1', command: ['sh', '-c', 'echo hello2']}]

results:

2021-10-19 14:31:26.473  WARN 1 --- [io-9393-exec-10] .s.c.d.s.s.i.DefaultTaskExecutionService : Failed to retrieve the log, returning verification message.                                                       │
│ io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://10.96.0.1/api/v1/namespaces/default/pods/t1-5kjpxjv858/log?pretty=false&tailLines=500. Message: a container name must b │
│ e specified for pod t1-5kjpxjv858, choose one of: [t1-dnm0omeklg c2]. Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=a container name must be specified for pod t1-5kjpxjv858 │
│ , choose one of: [t1-dnm0omeklg c2], metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProper │
│ ties={}).                                                                                                                                                                                                          │
│     at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:570)                                                                                                            │
jvalkeal commented 2 years ago

Not yet sure if this belong to spring-cloud-deployer-kubernetes or if server also need some fixes.

szopal commented 2 years ago

@cppwfs I get 2.9.2 version of SCDF and I have different error:

Log task execution 7179

unable to retrieve container logs for docker://89b4244e0447ec8d12383526c9463xxxx72fee124fff71f6e8003a0ef96046cd
unable to retrieve container logs for docker://4fbe057ecb1f0a6e14282e5631c265xxxx2da84aa38ae59a9578495dcf28d25a

when I try get log by View logs button. Anyone help?