exceptionkuberneteskubernetes-apiserverkube-apiserver

Is there documentation regarding exceptions thrown by kubernetes api server, it would be good to have in java but any language will do


We have a use case to monitor kubernetes clusters and I am trying to find the list of exceptions thrown by kubernetes to reflect the status of the k8s server (in a namespace) while trying to submit a job on the UI.

Example: if k8s server throws ClusterNotFound exception that means we cannot submit any more jobs to that api server.

Is there such a comprehensive list?

I came across this in Go Lang. Will this be it? Does java has something like this?


Solution

  • The file you are referencing is a part of Kubernetes library used by many Kubernetes components for API requests fields validations. As all Kubernetes components are written in Go and I couldn't find any plans to port Kubernetes to Java, it's unlikely to have a Java version of that file.

    However, there is an officially supported Kubernetes client library, written in Java, so you can check for the proper modules to validate API requests and process API responses in the java-client repostiory or on the javadoc site.

    For example, objects that are used to contain proper or improper HTTP replies from Kubernetes apiserver: V1Status and ApiExceptions, (repository link)

    Please consider to check java-client usage examples for better understanding.

    Detailed Kubernetes RESTful API reference could be found on the official page
    For example: Deployment create request

    If you are really interested in Kubernetes cluster monitoring and logging aspects, please consider to read the following articles at the beginning: