I have an issue with env variables that stored in k8s pods. I have created secret named REACT_APP_API_URL, but when i do console.log(process.env.REACT_APP_API_URL) it returning me undefined. I defined my secret using rancher, project was created using create-react-app. How to get access to this secrets stored on k8s secrets? screenshot from rancher
Asked
Active
Viewed 17 times
0
-
Does this answer your question? [kubectl secrets not accessible in React app Pods](https://stackoverflow.com/questions/66737106/kubectl-secrets-not-accessible-in-react-app-pods) – BernardV Jul 19 '23 at 08:26
-
i've already see this question, but it's not worked for me. I solved my problem, create react app doesn't have permission to use env variables that defined in your system, you need to go gitlab/github project settings find ci/cd, then in section variables define your env variables, and then it will work. I think variables defined in k8s pods, is set after build, then it cannot be accessed – Hanzo Hattori Jul 19 '23 at 09:04