<p>Kubernetes java client has the sdk functions to create deployment, services and many other core kubernetes function. How can I access custom resources like that of istio's service entry, destination rules, virtual services from kubernetes java client?</p>

<p>To connect to Istio you can use the project <strong><a href="https://github.com/snowdrop/istio-java-api" rel="nofollow noreferrer">istio-java-api</a></strong>. This project use  the same approach as Fabric8’s kubernetes-model.
The example below shows how to build and create a VirtualService:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import me.snowdrop.istio.api.networking.v1alpha3.ExactMatchType;
import me.snowdrop.istio.api.networking.v1alpha3.VirtualService;
import me.snowdrop.istio.api.networking.v1alpha3.VirtualServiceBuilder;
import me.snowdrop.istio.client.DefaultIstioClient;
import me.snowdrop.istio.client.IstioClient;


Config config = new ConfigBuilder().withMasterUrl(masterURL).build();
IstioClient istioClient = new DefaultIstioClient(config);


VirtualService virtualService = new VirtualServiceBuilder()
        .withApiVersion("networking.istio.io/v1alpha3")
        .withNewMetadata()
        .withName("details")
        .endMetadata()
        .withNewSpec()
        .withHosts("*")
        .withGateways("system-gateway")
        .addNewHttp()
        .addNewRoute()
        .withNewDestination()
     	.withHost("service-example")
        .withNewPort()
        .withNewNumberPort(9900)
        .endPort()
	.endDestination()
        .endRoute()
        .endHttp()
        .endSpec()
        .build();
        
 istioClient.virtualService().create(virtualService);</code></pre>
</div>
</div>
</p>
