I am wondering if it is possible to have a byte array as kubernetes secret. I created a byte array and a base64-encoded string as below
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[32];
random.nextBytes(bytes);
for (int i = 0; i < bytes.length; i++) {
System.out.print(bytes[i] + ",");
}
String token = Base64.getEncoder().withoutPadding().encodeToString(bytes);
Then I used the resulting string in a kubernetes secret. The secret gets created successfully. Now I would like my Spring Boot application, that is running in kubernetes, to read and decode that value. However, I get an IllegalArgumentException (Illegal base64 character) When running the application locally reading the same token from a properties file, it can be decoded.
So my question again: Is it possible to use a byte array as kubernetes secret?