Kubernetes-client: How to deploy Kubeflow in fabric8?

Created on 10 Dec 2020  路  5Comments  路  Source: fabric8io/kubernetes-client

Hi, I'm trying to connect to k8s from my java program using fabric. I have kubeflow/pytorchjob installed on the k8s, however, fabric8 client can not connect to it, saying "no resource type found kubeflow.org/v1#pytorchjob". Do you know how to fix this problem without creating kubeflow as a CRD from fabric8? Thanks!!

question

Most helpful comment

Do you have POJO for pytorchjob Custom resource? If yes, you can try registering it to KubernetesDeserializer like this:

KubernetesDeserializer.registerCustomKind("kubeflow.org/v1", "PyTorchJob", PyTorchJob.class);

If you don't have POJO, I would suggest using the Raw API for CustomResources

All 5 comments

Could you please share code that you're using to deploy?

Could you please share code that you're using to deploy?
Thanks for the reply. Here's the code

`

    parallelWorkerString = FTLUtils.renderTemplate("PytorchJob.ftl", model);
    try {
        InputStream is = IOUtils.toInputStream(parallelWorkerString, "UTF-8");
        List<HasMetadata> result = k8SClusterConfig.getClient(cluster).load(is).get();
        log.info("load result: {}", JSON.toJSONString(result));
        List<HasMetadata> list = k8SClusterConfig.getClient(cluster).resourceList(result).createOrReplace();
        log.info("resourceList result: {}", JSON.toJSONString(list));
  } ...

`

Do you have POJO for pytorchjob Custom resource? If yes, you can try registering it to KubernetesDeserializer like this:

KubernetesDeserializer.registerCustomKind("kubeflow.org/v1", "PyTorchJob", PyTorchJob.class);

If you don't have POJO, I would suggest using the Raw API for CustomResources

Do you have POJO for pytorchjob Custom resource? If yes, you can try registering it to KubernetesDeserializer like this:

KubernetesDeserializer.registerCustomKind("kubeflow.org/v1", "PyTorchJob", PyTorchJob.class);

If you don't have POJO, I would suggest using the Raw API for CustomResources

The raw api for crd worked!! It's exactly what I needed. Thanks a lot

I'm closing this issue now, feel free to open another issue if you encounter any problem.

Was this page helpful?
0 / 5 - 0 ratings