New to fabric8 K8S client library. Recently was trying to create a custom resource object using fabric8 (v6.1.1) and got Not Found Message at the POST Call internally. Can list on the CRD client on which this POST is performed.
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://cluster-xyz.domain.com/apis/<resource spec.group>/v1/<crdname>. Message: Not Found.
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:713)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:693)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:644)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$handleResponse$0(OperationSupport.java:581)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$retryWithExponentialBackoff$2(OperationSupport.java:622)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at io.fabric8.kubernetes.client.okhttp.OkHttpClientImpl$4.onResponse(OkHttpClientImpl.java:268)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Created a CRD client in code and able to list on it :
MixedOperation<CRD_POJO, KubernetesResourceList<CRD_POJO>, Resource<CRD_POJO>> CRDClient = apiClient.resources(CRD_POJO.class);
System.out.println("CRDclient List:::::" + CRDClient.list());
Till this point it works fine and I am able to list the objects as well but after that created a custom object of type CRD and tried doing a create on the CRD client and it failed with the above error.
CRD_POJO CR = new CRD_POJO();
// Some set operations to make the CR object ready
...
CRD_POJO created = CRDClient.inNamespace("test").createOrReplace(CR);//Here it fails
Anyone faced this or know any solution? Any lead will help to solve this issue
As @RohanKumar pointed, implementing the "Namespaced" interface in this case solved the issue.
@JsonIgnoreProperties(value ={"status"}) @Version("v1") @Group("<resource spec.group>") public class CRD_POJO extends CustomResource<CRD_POJOSpec, CRD_POJOStatus> implements Namespaced { ..... }