Hi Rodrigo, Thanks for the reply First of all this is stable external image and I dont want to maintain my version. Secondly, the values that I would like to get are created during my deployment (ingress external host urls) and I can only map them during container initializing.
What i tried in 1st option is trying to create environment variable with the value of executing the command $(eval cat <PATH>) Here is the block I am trying in statefulset - name: KAFKA_ADVERTISED_LISTENERS value: INSIDE://$(POD_IP):9092,OUTSIDE://$(eval cat /opt/conf/ext-url):9093 And ext-url is mounted via dynamic configMaps - name: cm-vol configMap: name: kafka-0 items: - key: kafka-ext-host path: ext-host Note: I went to this direction after observing that reading from dynamic configMap is not working valueFrom: configMapKeyRef: key: kafka-ext-host name: $(POD_NAME) . --> Kubernetes giving error to here So the question is that, can I use "cat <PATH>" command to environment variable ? I hope it is little bit clear now :) Sorry for the mess Regards, On Friday, August 17, 2018 at 8:11:15 PM UTC-4, Rodrigo Campos wrote: > > Sorry, what is thing number 1 you tried? Is that in the yaml or where? Not > sure what you mean > > As a hack, can't you change your docker file to do on startup (CMD): > export var=$(...); ./your-app ? Does it work? > > Probably, he simplest thing might be for the app to read the proper > variable using it's host name. I think that would be the best, bit you can > try the hack above in the meantime or to experiment :-) > > On Friday, August 17, 2018, ilter P <ilterp...@gmail.com <javascript:>> > wrote: > >> Hi, >> >> I have statefulset which has specific configuration for each host. >> I created different Configmap with each hostname and mounted them under >> the path with the hostnames as following: >> <STATIC_PATH>/$(HOSTNAME)/<STATIC_PATH >> >> Now I need to pass this into a configuration file like: >> >> Variable inside the conf file** >> >> OUTSIDE://*<VALUE_FROM_THE_MOUNTED_FILE>* >> >> *I tried following options:* >> >> *1- OUTSIDE://$(eval cat <PATH>) . --> did not work* >> *2- exported another env variable from initContainer --> did not work* >> >> *Is there a way to set environment variables by using a command as:* >> *- name: ENV_VARIABLE* >> * valueFrom:* >> * command:* >> * - sh* >> * - export X=`cat <PATH>`* >> >> *Please help* >> >> *Thanks* >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Kubernetes user discussion and Q&A" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to kubernetes-use...@googlegroups.com <javascript:>. >> To post to this group, send email to kubernet...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/kubernetes-users. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group. To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscr...@googlegroups.com. To post to this group, send email to kubernetes-users@googlegroups.com. Visit this group at https://groups.google.com/group/kubernetes-users. For more options, visit https://groups.google.com/d/optout.