When setting up https for Grafana we need separate files to set the security. One with the certificate chain in PEM format and another with the private key.
Step 1: Convert the JKS keystore to the PKCS12 format. After that it will be easier to extract the certificate chain and the private key.
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -srcstoretype JKS -deststoretype PKCS12 -srcalias er to extract the certificate chain and the private key. -destalias server -srcstorepass 'password' -deststorepass 'password' -srckeypass 'password' -destkeypass 'password'
Step 2: Extract the private key using openssl
openssl pkcs12 -in keystore.p12 -nocerts -nodes -out grafana.key
Step 3: Extract the certificate chain using openssl
openssl pkcs12 -in keystore.p12 -nocerts -nodes -out grafana.key