Cannot initialize SSL - Invalid keystore format

Hello all,

I have installed an Elasticsearch cluster (ECK) in my Kubernetes cluster (GKE) by using this tutorial.

I retrived the CA certificat tls.crt created by my ECK. Then, I used the following command to create a truststore.jks

keytool -import -trustcacerts -alias ca_root -file tls.crt -keystore truststore.jks

PS: I am using openjdk version "1.8.0_242"

Then, I create a Kubernetes secret:

apiVersion: v1
kind: Secret
  name: elasticsearch-truststore-secret
  namespace: dev
type: Opaque
  truststore.jks: <<content of truststore.jks in base64>>

Finally, I specified in the configuration of my spark job, the following information:                 true              true                          https://smart-agriculture-elasticsearch-es-http                           9200             elastic             <<password of elastic user>>                        true true    file:///etc/secrets/elasticsearch/truststore.jks        test1234
spark.kubernetes.driver.secrets.elasticsearch-truststore-secret /etc/secrets/elasticsearch/truststore.jks
spark.kubernetes.executor.secrets.elasticsearch-truststore-secret /etc/secrets/elasticsearch/truststore.jks

I got the following error:

Caused by: Invalid keystore format at at$JKS.engineLoad( at at$DualFormatJKS.engineLoad( at at at at ... 41 more

I don't know what I am doing wrong.
Does anyone know how to solve this ?

A little bit of help please, I didn't find a way :frowning: !

Solution in How to create Keystore and Truststore from CA Certificates