I’m curious about task deploy lamp stack on kubernetes cluster. I writed all prerequisites in yaml manifest definition. Pods all was working fine but php could not connect to MYSQL_HOST and the error in logs was "unknown MYSQL host ‘value_from_env’ ". I checked all 10 times and all env variables was good, but still it was not working. Then I found that people were creating secret with command line and in that way php was working fine. Any ideas why creating secrets from manifest not working?
Here will be complete definitions. I don’t think that at this case there is difference what type of “data” I use if at the end I got the same value of environment variable.
Question was not about to add something more to definitions. If I cut out secret definition and manually add secret with command with the same values it’s working, without adding extra configuration to containers. So I cannot understood where is difference. Adding secrets with command or adding secrets with definiton if the values are same at the end, but working only when performed from command.
At first it was mysql-service (didn’t worked also if secret was from definition), but for testing I tried many things to check if all working with variables normally. Copied here wrong version of base64 encoding of secrets.
OK, The point is that your YAML is correct as it is.
Baring any wrong values in your secrets most probably the problem is how do you use these variables in your PHP code.
I created all definitions with correct values and so on. Deployed LAMP and PHP couldn’t connect to database. Started to investigate and playing with variables, no success. Then I found in internet that all who was completing this task, was using command line to add secrets, tried also and whola worked.
So I was confused, where the difference. As per task PHP must read variables from environment variables and with this also all is good.
Thank you it’s okey I’m not stuck. I’m trying to find difference how task could be completed.
But it could be that on first try I messed something up and both solutions are working just fine.