How to get kubernetes secret data from java

5/30/2018

By following link https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/ it is described how to add secret (encripted) data.

How to get that key-value s with from java client?

-- emanuel07
fabric8
java-client
kubernetes

1 Answer

5/30/2018

You can use the official Java client for Kubernetes’ REST API and read the secret as defined in this doc. You will get a result of return type V1Secret.

V1Secret result = apiInstance.readNamespacedSecret(name, namespace, pretty, exact, export);

This object result has a property data of type Map<String, byte> to get the key value pairs from.

-- Javatar81
Source: StackOverflow