I try to pass one full stack application hosted in Heroku to another hosted in a kubernetes cloud (Digital Ocean exactly): I am stuck with the keys. In the original full stack application I have a file where I put the keys for development env:
module.exports={
googleClientID: 'Client ID',
googleClientSecret: 'secret sequence',
mongoURI: 'mongodb+srv://data_to_connect',
cookieKey: 'some_code',
fbClientID: 'Client ID',
fbClientSecret: 'secret sequence',
stripePublishableKey: 'public key',
stripeSecretKey: 'secret sequence'
}
And after another file with the keys for production. In this case the secrets were put in the Heroku environment; so, this file, made public, didnĀ“t show the secret keys.
module.exports={
googleClientID: 'Client ID',
googleClientSecret: GOOGLE_CLIENT_SECRET, // Place in Heroku host
...
}
Now, I try to convert this application in a kubernetes application. In the kubernetes config. file for the server, I placed the above keys as environment variables:
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-depl
...
template:
metadata:
labels:
app: server
spec:
containers:
- name: server
image: myimage
env:
- name: googleClientID
value: 'Client ID' // Same that above
- name: googleClientSecret // Secret made with kubernetes secret generic command
valueFrom:
secretKeyRef:
name: google-secret
key: googleClientSecret
....
And after referencing those env. variables in the proper file with process.env.KEY, that would work in the dev. environment (with skaffold) as in production environment (digital ocean).
clientID: process.env.googleClientID,
clientSecret: process.env.googleClientSecret,
That is not working. Some hint how to do that transfer?