How to pass a certificate as a variable in values.yaml of helm chart

1/6/2020

This is the certificate that needs to be passed as a string.

-----BEGIN CERTIFICATE-----
MIICyTCCAbTCEF+F3G/7tLCJj9mZ/RiaPQEwDQYJKoZIhvcNAQELBQAwIzEhMB8G
A1UEAxMYc2FjLWh2bTAwODc5LnN3aW5mcmEubmV0MB4XDTE5MDkyMDEwMDk1NloX
DTQ0MDkxMzEwMDk1NlowIzEhMB8GA1UEAxMYc2FjLWh2bTAwODc5LnN3aW5mcmEu
bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmBCXjv7/8pjzUyq
O52/NAVgOpVAj+i4d1bMdFvfonUzZVzvTfmTxLoHVXAAYrivYq5Y9hpTVIxM0rWj
A5yMiXiO8Dx27v3eiacC5dqOCPD/KeARY0r6C3lL9+CPJYhtxiEDk7N+58GOaq1s
iPacwKxJurLH2FTr4xlau0UQj1DBZEc9yZJl4FDAayEVnqN8moAYqrVPPVrBfKW8
sKJSHZHaj8YEp46fzcymM2KeZytxw1ZzSoOYiwiSSNwivC19DINx0b4DEvvGwL/Y
nJtTPQRcJ3oB83Zv7vQPFWDvj63lXQ87R3LXRF3xxy42ebXmcRP4I+edGYnjGa73
vAZh2wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQB2SOa8ZHRoP7V6bzA6FSc032Rw
Hpf4IiHNfkENorcNvA/rpkVdV9V9TceNlQi1KWSH/4Ty+LhdbHdoqWYivfc47Xj0
ZReq5v/2j3RNmxDRBf4ugAFqFnhzvZn8lt4J/C3kcevPqcsK/1UHtUBiFi1Y2nka
AsomYfH3AEgGYax8YGSdF0LW0USEeXZiaMf+Z5+N43d8BoCdGOkPZZQEIMaQwnxM
ouLisTV113x0vzHZR7b1JzZyMF5zYw88Lsul+TEOfkpY0zjmoptFM26pYSkx8J87
n0aTe1ZN7TFDZ3zu629BHYfcwvy2F/m0E6rnFRa7o4o6qXJSfZIe1kqqvbRc
-----END CERTIFICATE-----

Variable in helm chart is

global:
  dbvalues:
    dbcacertificate:  
-- Darshil Shah
kubernetes
kubernetes-helm

3 Answers

1/6/2020

You can store a certificate in config map or in secret and pass it further.

You can create secret and store value in it and use it as env variable or else you can save the value in values.yaml and point it in helm chart.

-- Harsh Manvar
Source: StackOverflow

1/6/2020

My solution for this problem was to base64 encode the value, and afterwards decode it in the chart.

-- Radu Mazilu
Source: StackOverflow

1/6/2020

I found a way to pass the certificate which worked.

global:
 dbvalues:
   dbcacertificate: |
    -----BEGIN CERTIFICATE-----
    MIICyTCCAbTCEF+F3G/7tLCJj9mZ/RiaPQEwDQYJKoZIhvcNAQELBQAwIzEhMB8G
    A1UEAxMYc2FjLWh2bTAwODc5LnN3aW5mcmEubmV0MB4XDTE5MDkyMDEwMDk1NloX
    DTQ0MDkxMzEwMDk1NlowIzEhMB8GA1UEAxMYc2FjLWh2bTAwODc5LnN3aW5mcmEu
    bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmBCXjv7/8pjzUyq
    O52/NAVgOpVAj+i4d1bMdFvfonUzZVzvTfmTxLoHVXAAYrivYq5Y9hpTVIxM0rWj
    A5yMiXiO8Dx27v3eiacC5dqOCPD/KeARY0r6C3lL9+CPJYhtxiEDk7N+58GOaq1s
    iPacwKxJurLH2FTr4xlau0UQj1DBZEc9yZJl4FDAayEVnqN8moAYqrVPPVrBfKW8
    sKJSHZHaj8YEp46fzcymM2KeZytxw1ZzSoOYiwiSSNwivC19DINx0b4DEvvGwL/Y
    nJtTPQRcJ3oB83Zv7vQPFWDvj63lXQ87R3LXRF3xxy42ebXmcRP4I+edGYnjGa73
    vAZh2wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQB2SOa8ZHRoP7V6bzA6FSc032Rw
    Hpf4IiHNfkENorcNvA/rpkVdV9V9TceNlQi1KWSH/4Ty+LhdbHdoqWYivfc47Xj0
    ZReq5v/2j3RNmxDRBf4ugAFqFnhzvZn8lt4J/C3kcevPqcsK/1UHtUBiFi1Y2nka
    AsomYfH3AEgGYax8YGSdF0LW0USEeXZiaMf+Z5+N43d8BoCdGOkPZZQEIMaQwnxM
    ouLisTV113x0vzHZR7b1JzZyMF5zYw88Lsul+TEOfkpY0zjmoptFM26pYSkx8J87
    n0aTe1ZN7TFDZ3zu629BHYfcwvy2F/m0E6rnFRa7o4o6qXJSfZIe1kqqvbRc
    -----END CERTIFICATE-----
-- Darshil Shah
Source: StackOverflow