Kubernetes/Helm: any examples with ConfigMap and "binaryData:"?

7/14/2018

With Kubernetes 1.10.* we can use binaryData: with ConfigMap and I am trying to combine it with Helm:

apiVersion: v1
kind: ConfigMap
metadata:
  name: some_config_map
data:
  text_data: |-
    {{ .Files.Get "truststores/simple_text_file.txt" }}
binaryData:
  trustore.jks: |-
    {{ .Files.Get "truststores/trustore.jks" | b64enc }}

I am not sure about the last line - regardless of syntax:

 {{ "truststores/trustore.jks" | b64enc }}
 {{ "truststores/trustore.jks" }}

the trustore.jks is empty when I deploy it.

So how can I use binaryData: ?

-- pb100
kubernetes
kubernetes-helm

1 Answer

7/16/2018

Your syntax looks fine and everything should work properly. Files in the field binaryData must be encoded with base64, so, {{ .Files.Get "truststores/trustore.jks" | b64enc }} is correct.

Try to apply the configuration with debug key and investigate what went wrong, possibly there is no such file or there are some problems with encoding.

-- Artem Golenyaev
Source: StackOverflow