public class ExpandedExample extends Object
Easiest way to run this: mvn exec:java -Dexec.mainClass="io.kubernetes.client.examples.ExpandedExample"
From inside $REPO_DIR/examples
| Constructor and Description |
|---|
ExpandedExample() |
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getAllNameSpaces()
Get all namespaces in k8s cluster
|
static List<String> |
getNamespacedPod()
List all pod in the default namespace
|
static List<String> |
getNamespacedPod(String namespace)
List pod in specific namespace
|
static List<String> |
getNamespacedPod(String namespace,
String label)
List pod in specific namespace with label
|
static List<String> |
getPods()
List all pod names in all namespaces in k8s cluster
|
static List<String> |
getServices()
List all Services in default namespace
|
static void |
main(String[] args)
Main method
|
static void |
printLog(String namespace,
String podName)
Print out the Log for specific Pods
|
static void |
scaleDeployment(String deploymentName,
int numberOfReplicas)
Scale up/down the number of pod in Deployment
|
public static void main(String[] args)
args - public static List<String> getAllNameSpaces() throws io.kubernetes.client.openapi.ApiException
io.kubernetes.client.openapi.ApiExceptionpublic static List<String> getPods() throws io.kubernetes.client.openapi.ApiException
io.kubernetes.client.openapi.ApiExceptionpublic static List<String> getNamespacedPod() throws io.kubernetes.client.openapi.ApiException
io.kubernetes.client.openapi.ApiExceptionpublic static List<String> getNamespacedPod(String namespace) throws io.kubernetes.client.openapi.ApiException
namespace - io.kubernetes.client.openapi.ApiExceptionpublic static List<String> getNamespacedPod(String namespace, String label) throws io.kubernetes.client.openapi.ApiException
namespace - label - io.kubernetes.client.openapi.ApiExceptionpublic static List<String> getServices() throws io.kubernetes.client.openapi.ApiException
io.kubernetes.client.openapi.ApiExceptionpublic static void scaleDeployment(String deploymentName, int numberOfReplicas) throws io.kubernetes.client.openapi.ApiException
deploymentName - numberOfReplicas - io.kubernetes.client.openapi.ApiExceptionCopyright © 2022. All rights reserved.