Hi,

Thanks for the reply..
I managed to do it as per Rodrigo's recommendation

1- I loaded the configmaps into different paths by using HostName
2- I read the values from the paths before starting the image as following:

- command:

    - sh

    - -exc

    - |

      export KAFKA_EXT_HOST=`cat /opt/data/shared/$HOSTNAME` && \

      export 
KAFKA_ADVERTISED_LISTENERS=INSIDE://$(POD_IP):9092,OUTSIDE://$KAFKA_EXT_HOST:9094
 
&& \

      start-kafka.sh



Thanks again and have a good day



On Sunday, August 19, 2018 at 3:11:34 AM UTC-4, Niranjan Kolly wrote:
>
> Use hostpath directory mount if you have more than one config file for 
> each env.. and use  node  antiaffinity.
>
>
> Thanks,
> Niranjan
>
> On Sat, Aug 18, 2018, 7:41 AM Rodrigo Campos <rodr...@gmail.com 
> <javascript:>> wrote:
>
>> On Friday, August 17, 2018, ilter P <ilterp...@gmail.com <javascript:>> 
>> wrote:
>>
>>> 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
>>>
>>>
>> So, it's the $(pod_ip) part working?
>> If so, why not have the file /opt/conf/ext-url be an env var? Is that 
>> file coming from a configMap volume? Or how is it created?
>>  
>>
>>> And ext-url is mounted via dynamic configMaps
>>> - name: cm-vol
>>>         configMap:
>>>           name: kafka-0
>>>           items:
>>>           - key: kafka-ext-host
>>>             path: ext-host
>>>
>>
>> Why not use an env variable from the configMap? If that is what you want 
>> in an env var, you can just have it. Instead of using it as a volume, use 
>> it as an env var.
>>
>> What am I missing?
>>  
>>
>>>
>>> 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
>>>
>>
>> Yeah, that won't work
>>  
>>
>>>
>>> So the question is that, can I use "cat <PATH>" command to environment 
>>> variable ?
>>>
>>
>> Not as part of the yaml. But if you have it mounted as the item you want, 
>> you may just have it as an env var.
>>
>> And if it's not the case, the hack I mentioned in my previous mail I 
>> think should work.
>>  
>>
>>>
>>> I hope it is little bit clear now :) Sorry for the mess
>>>
>>
>> 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.

Reply via email to