Kubernetes Java API (KubernetesClient)

10/18/2016

Simple question. I am using KubernetesClient by Fabric8. How do I get the deployment name by namespace? I tried

DeploymentList list = client.extensions().deployments().inNamespace(namespace).list();

I cannot get the name from it.. Any code snippet to get name by namespace will be great.

-- Nir Koren
fabric8
java
kubernetes

1 Answer

10/18/2016

Try :

DeploymentList list = client.extensions().deployments().inNamespace(namespace).list();
for (Deployment d : list.getItems()) {
    System.out.println(d.getMetadata().getName());
}
-- Jimmi Dyson
Source: StackOverflow