<p>Kubernetes OpenAPI specification is hosted here. </p>

<pre><code>https://github.com/kubernetes/kubernetes/tree/master/api/openapi-spec
</code></pre>

<p>Additionally, various client APIs for the Kubernetes is provided here:</p>

<pre><code>https://kubernetes.io/docs/reference/using-api/client-libraries/
</code></pre>

<p>Using the OpenAPI specification, I am able to generate the server code, which provides the REST services. However, the applications using these K8s client APIs (written in either language - Go, Java, etc.) do not use these REST API directly. </p>

<p>My objective is to mock the K8s server to use in the test automation and build a controlled environment to create various test scenarios. </p>

<p>Is there any ready-to-use Kubernetes mock available? If not, how we can interface the client APIs with the above OpenAPI generated REST server? This way, the applications shall continue to use the client APIs but internally, they will be communicating with the mocked K8s server and not the real one. </p>

<p>Please help with the options. </p>

<p>.</p>

AnilJ
<p>Not really a direct answer to your question, but most solutions i have seen implemented are not trying to mock the k8s API but are really using it through either k3s (from rancher labs) or KinD project (official way)</p>
<p>You then connect to it like a normal kubernetes cluster</p>
