Re: [kubernetes-users] [Statefulset]Setting environment variables specific to each HOSTNAME loading from certain PATH mounted to container

2018-08-20 Thread ilter P
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  > wrote:
>
>> On Friday, August 17, 2018, ilter P > 
>> 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 )
>>>
>>> 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 " 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 .
>> To post to this group, send email to kubernet...@googlegroups.com 
>> .
>> 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.


Re: [kubernetes-users] [Statefulset]Setting environment variables specific to each HOSTNAME loading from certain PATH mounted to container

2018-08-17 Thread ilter P
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 )

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 " 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 > 
> 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:
>> /$(HOSTNAME)/>
>> Now I need to pass this into a configuration file like:
>>
>> Variable inside the conf file**
>>
>> OUTSIDE://**
>>
>> *I tried following options:*
>>
>> *1- OUTSIDE://$(eval cat ) . --> 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 `*
>>
>> *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 .
>> To post to this group, send email to kubernet...@googlegroups.com 
>> .
>> 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.


[kubernetes-users] [Statefulset]Setting environment variables specific to each HOSTNAME loading from certain PATH mounted to container

2018-08-17 Thread ilter P
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:
/$(HOSTNAME)/*

*I tried following options:*

*1- OUTSIDE://$(eval cat ) . --> 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 `*

*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-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.


[kubernetes-users] Pod in minion cannot reach the DNS in Master. But Pod in master works fine!

2017-03-17 Thread ilter P
Hi,

I have an kubernetes installation with 2 Nodes (Master,Minion) and i am 
following (ai,i) installation.
Here is the versions that i am using:

export KUBE_VERSION=1.5.4
export FLANNEL_VERSION=0.7.0
export ETCD_VERSION=3.0.14

Kernel: Linux kube-ubuntu01 3.13.0-113-generic #160-Ubuntu SMP Thu Mar 9 
09:27:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

The Problem is, when we start the master itself and deploy busybox then it 
can see the DNS and we can ping the DNS service ip from pod.
However when we bring the minion up and start a busybox pod inside minion 
then it cannot resolve DNS also cannot ping DNS service Ip.

This is ifcongif output in minion:

docker0   Link encap:Ethernet  HWaddr 02:42:36:15:00:5a  
  inet addr:172.16.46.1  Bcast:0.0.0.0  Mask:255.255.255.0
  inet6 addr: fe80::42:36ff:fe15:5a/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1
  RX packets:3792 errors:0 dropped:0 overruns:0 frame:0
  TX packets:154 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:309901 (309.9 KB)  TX bytes:7484 (7.4 KB)

eth0  Link encap:Ethernet  HWaddr 00:50:56:01:19:90  
  inet addr:10.103.12.30  Bcast:10.103.12.31  Mask:255.255.255.240
  inet6 addr: fe80::250:56ff:fe01:1990/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:183891 errors:0 dropped:163 overruns:0 frame:0
  TX packets:172658 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000 
  RX bytes:127076052 (127.0 MB)  TX bytes:34809987 (34.8 MB)

flannel.1 Link encap:Ethernet  HWaddr 7a:63:b4:90:9a:42  
  inet addr:172.16.46.0  Bcast:0.0.0.0  Mask:255.255.255.255
  inet6 addr: fe80::7863:b4ff:fe90:9a42/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1
  RX packets:6 errors:0 dropped:0 overruns:0 frame:0
  TX packets:239 errors:0 dropped:8 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:528 (528.0 B)  TX bytes:21443 (21.4 KB)

loLink encap:Local Loopback  
  inet addr:127.0.0.1  Mask:255.0.0.0
  inet6 addr: ::1/128 Scope:Host
  UP LOOPBACK RUNNING  MTU:65536  Metric:1
  RX packets:102 errors:0 dropped:0 overruns:0 frame:0
  TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:8040 (8.0 KB)  TX bytes:8040 (8.0 KB)

veth8ff900b Link encap:Ethernet  HWaddr 7a:12:a0:8b:7e:11  
  inet6 addr: fe80::7812:a0ff:fe8b:7e11/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1450  Metric:1
  RX packets:3792 errors:0 dropped:0 overruns:0 frame:0
  TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:362989 (362.9 KB)  TX bytes:8132 (8.1 KB)

**

I did Tcpdump in minion docker0 interface during the ping and got output 
like this:


tcpdump -v -i docker0
tcpdump: listening on docker0, link-type EN10MB (Ethernet), capture size 
65535 bytes
09:55:14.864015 IP (tos 0x0, ttl 64, id 34828, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 0, length 64
09:55:15.864209 IP (tos 0x0, ttl 64, id 34901, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 1, length 64
09:55:16.864375 IP (tos 0x0, ttl 64, id 34935, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 2, length 64
09:55:17.864531 IP (tos 0x0, ttl 64, id 35047, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 3, length 64
09:55:18.864685 IP (tos 0x0, ttl 64, id 35190, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 4, length 64
09:55:19.864185 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 
172.16.46.1 tell 172.16.46.2, length 28
09:55:19.864217 ARP, Ethernet (len 6), IPv4 (len 4), Reply 172.16.46.1 
is-at 02:42:36:15:00:5a (oui Unknown), length 28
09:55:19.864818 IP (tos 0x0, ttl 64, id 35256, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 5, length 64
09:55:20.864942 IP (tos 0x0, ttl 64, id 35381, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 6, length 64
09:55:21.865077 IP (tos 0x0, ttl 64, id 35622, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 7, length 64
09:55:22.865216 IP (tos 0x0, ttl 64, id 35719, offset 0, flags [DF], proto 
ICMP (1), length 84)
172.16.46.2 > 192.168.3.10: ICMP echo request, id 2304, seq 8, length 64
09:55:23.865351 IP (tos 0x0

[kubernetes-users] Installing Kubernetes to Centos with Proxy

2017-01-03 Thread ilter P
Hi,

I need recommendation on how to install kubernetes in a private network ?
I have Centos VMs and they cannot access Internet directly. I need to set 
an http_proxy

So the problem in here for my kubernetes networking. Since I am facing 
following issues:
- Pods cannot see each other if they are in different nodes
- Containers cannot reach outside. f.i,fabric.forge cannot reach 
"https://start.spring.io/";

I could not find any installation instructor where it covers this scenario.

Could you please help please ?

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-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.