Skip to content

field volumeMounts in the JSON string is not defined in the V1ContainerStatus #3980

Closed

Description

@yanivkr

Describe the bug

java.lang.IllegalArgumentException: The field volumeMounts in the JSON string is not defined in the V1ContainerStatus properties. JSON: {"name":"dummy-job-container","state":{"waiting":{"reason":"ContainerCreating"}},"lastState":{},"ready":false,"restartCount":0,"image":"redacted","imageID":"","started":false,"volumeMounts":[{"name":"kube-api-access-tlhrb","mountPath":"/var/run/secrets/[kubernetes.io/serviceaccount](http://kubernetes.io/serviceaccount)","readOnly":true,"recursiveReadOnly":"Disabled"}]}

Client Version
20.0.1

Kubernetes Version
1.31.6-gke

Java Version
Java 11

To Reproduce
Use the client version with the k8s version and execute coreApi.listNamespacedPod(namespace).execute().getItems()

Expected behavior
I expect it work according to https://github.com/kubernetes-client/java/wiki/2.-Versioning-and-Compatibility

KubeConfig
If applicable, add a KubeConfig file with secrets redacted.

Server (please complete the following information):

  • OS: [e.g. Linux]
  • Environment [e.g. container]
  • Cloud [e.g. Azure]

Additional context
Add any other context about the problem here.

Activity

  1. brendandburns commented on Mar 17, 2025

    @brendandburns
    Contributor

    Please upgrade to Kubernetes 22.0.x or newer since you are using Kubernetes 1.31

    As the document says, 20.0.0 has a + which indicates "java-client has features or api objects that may not be present in the Kubernetes cluster, but everything they have in common will work."

    I think that field must have been added in 1.31

  2. esevan commented on Mar 25, 2025

    @esevan

    Please upgrade to Kubernetes 22.0.x or newer since you are using Kubernetes 1.31

    As the document says, 20.0.0 has a + which indicates "java-client has features or api objects that may not be present in the Kubernetes cluster, but everything they have in common will work."

    I think that field must have been added in 1.31

    +1, Sounds reasonable, but is it possible to make java client compatible with newly added field such as volumeMounts in this issue by ignoring deserialization?

  3. yanivkr commented on Mar 26, 2025

    @yanivkr
    Author

    Thanks, I've upgraded my Java client to resolve the issue but still think it would be better to ignore fields that are not present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions