Hot questions for Using Azure in azure sdk


public void runKubernetes() {
    KubernetesCluster k8sCluster = this.getKubernetesCluster("xyz-aks");
    System.out.println("Kubernetes Cluster String: " +;

    DefaultKubernetesClient kubeclient = new DefaultKubernetesClient();
    System.out.println("Kube client Master URL :"+kubeclient.getMasterUrl());

    NodeList kubenodes = kubeclient.nodes().list();
    for (Node node : kubenodes.getItems()) {
        System.out.println( node.getKind() + " => " + node.getMetadata().getName() +": " + node.getMetadata().getClusterName());

I get Client and nodes. Now, I have yaml file and I want to deploy that yaml (create service, deployment and pods) programatically.

I can do following

kubectl create -f pod-sample.yaml 

but I want to do same thing using JAVA SDK.

I am using following java libraries for kubernetes:



I believe you can parse the YAML or JSON of the deployment definition. For example, for YAML you can use any of the Java libraries here

  • JvYaml # Java port of RbYaml
  • SnakeYAML # Java 5 / YAML 1.1
  • YamlBeans # To/from JavaBeans
  • JYaml # Original Java Implementation
  • Camel # YAML 1.2 for Java. A user-friendly OOP library.

Jackson seems to be the more popular for JSON which also supports a YAML extension.

Then once you parse say the name, for example to create a service:

Service myservice =
                       .addToLabels(parsedLabel1, parseLabel2)


I am working on developing a file system manager client that connects and do file handling with Azure file share using Java.

By referring Azure docs I could see how a connection is made with the connection string and how the file manipulation is done. But there is no such thing as a connection close step.

I wonder if for Azure, created connections automatically get closed or is the doc missing something? As far as I know, if a connection is made, that needs to be closed after the tasks related with are done.

Help me clarify this.


Considering the SDK is simply a wrapper over HTTP REST API, the moment the operation is complete (i.e. response is received), the connection automatically closes. You don't have to do anything special to close the connection.