Thanks Matthias,  That’s pretty much where I landed too.  I already have a 
utility that will query the api so I can just add the functionality there.  The 
other option was to send the hostname or service to the router and let the 
router look up the external ip based off the service name.  Either way ends up 
at the same conclusion.  We have to query the service for the information.  The 
last hurdle is making sure we wait to register until the service has an EIP 
allocated and registered.

Thanks!


From: [email protected] 
[mailto:[email protected]] On Behalf Of Matthias Rampke
Sent: Friday, March 03, 2017 13:16 PM
To: [email protected]
Subject: [URL] Re: [kubernetes-users] Re: Passing external Node/Minion IP to Pod

You can find out everything there is to know about the node from the Kubernetes 
API. A simple way to access that may be to include the kubectl binary in the 
container, rely on the auth token it gets from the default ServiceAccount, and 
script the registration around that.

The use the Downward API[0] to let the pod know the pod name and namespace via 
environment variables, and find the node name from there. Then fetch the node 
details.

/MR


[0] 
https://kubernetes.io/docs/tasks/configure-pod-container/environment-variable-expose-pod-information/<http://antispam.high5.local:32224/?NDY1ZTQzMGU1ZjVjMDcwZjQ9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY1MWU0NTU4NDA1YjUyMDA9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGa3ViZXJuZXRlcyUyRWlvJTJGZG9jcyUyRnRhc2tzJTJGY29uZmlndXJlLXBvZC1jb250YWluZXIlMkZlbnZpcm9ubWVudC12YXJpYWJsZS1leHBvc2UtcG9kLWluZm9ybWF0aW9uJTJG>

On Fri, Mar 3, 2017 at 6:30 PM <[email protected]<mailto:[email protected]>> wrote:
Brian, I am in a situation where I have a series of pods that all need to have 
their own EIP.  The application running in the pod register's itself with a 
custom router giving statistics and metadata (including it's external ip).  
Clients make requests to the custom router and get back the EIP of the 'best' 
pod to connect to.  We are matching up 1 service to 1 deployment to allow the 
pod to have it's own EIP.

We are moving to kubernetes and would like to keep this process the same.  
Therefore, if the pod can find it's own EIP through an environment variable or 
hosts file or even a file written to the file system then we can continue with 
our current implementation.

I know this isn't exactly the same request as the OP but was curious if there's 
any suggestions that can be made.


On Tuesday, March 3, 2015 at 7:05:36 PM UTC-6, Brian Grant wrote:
> Do you want the host IP or the pod IP? If the former, why? Most containers 
> shouldn't need to know what hosts they are on. If the latter, can't you get 
> that from linux?
>
>
> You could also create one service per instance and pass the service DNS names 
> to whatever needs to know them. Eventually we plan to provide better support 
> for that pattern (see #260).
>
>
> If you need multiple ports on the same IP address, that change is in flight, 
> but there is a hack that makes it possible for services, described in another 
> recent thread about kafka/zookeeper:
> https://groups.google.com/forum/#!searchin/google-containers/kafka/google-containers/7e1x1r92SV0/vhbk2lOrxSkJ<http://antispam.high5.local:32224/?NDMxODVhMDA1NzVhMDM0ZTU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY2NWM1YzVlNWU1NzFlMDE9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZm9ydW0lMkYlMjMlMjFzZWFyY2hpbiUyRmdvb2dsZS1jb250YWluZXJzJTJGa2Fma2ElMkZnb29nbGUtY29udGFpbmVycyUyRjdlMXgxcjkyU1YwJTJGdmhiazJsT3J4U2tK>
>
> On Thursday, February 19, 2015 at 3:54:22 AM UTC-8, Stefan Jacobs wrote:
> Hi there,
>
>
> Is there a way to pass the external node IP to a pod?
>
>
> I have a kafka docker container that needs the host IP (advertised host i.e. 
> IP of node the pod is being deployed on).
>
>
> For instance, kubectl get pods returns:
>
>
>
> POD                      IP                  CONTAINER(S)        IMAGE(S)     
>             HOST                LABELS              STATUS
>
> zookeeper           10.244.36.4         zookeeper           zookeeper:latest  
>  
> 192.168.0.104/<http://antispam.high5.local:32224/?NTg0MzQ1MTEwYjFlNGQ1MDA9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY4MDExZDA4MDQwYTFkNTI9MTIzMyYmdXJsPWh0dHAlM0ElMkYlMkYxOTIlMkUxNjglMkUwJTJFMTA0JTJG>
>       name=zookeeper      Running
>
>
>
>
>
>
>
>
>
> I want a way of accessing that host IP (192.168.0.104) at pod startup.
> It would be nice to have a kubernetes evironment variable that simply pass 
> the IP of the host the pod is being deployed on. Like services are currently 
> doing with pod IPs.
> Thanks,
> Stefan

--
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 
[email protected]<mailto:kubernetes-users%[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at 
https://groups.google.com/group/kubernetes-users<http://antispam.high5.local:32224/?NDU0NzQyNGY1NjVlMGQwNjU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiZkNTYxZDVhNWQ1ZjFjMDU9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZ3JvdXAlMkZrdWJlcm5ldGVzLXVzZXJz>.
For more options, visit 
https://groups.google.com/d/optout<http://antispam.high5.local:32224/?NTg0MzQ1MTE0MjBiNGQ0ZTU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY2NDE1YzRjNDI0MTFkMDU9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZCUyRm9wdG91dA==>.
--
You received this message because you are subscribed to a topic in the Google 
Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/kubernetes-users/m_48qvTg9r0/unsubscribe<http://antispam.high5.local:32224/?NTg0MzQ1MTE0MjBiNGQ0ZTU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY2NDE1YzRjNDI0MTFkMDU9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZCUyRnRvcGljJTJGa3ViZXJuZXRlcy11c2VycyUyRm0lNUY0OHF2VGc5cjAlMkZ1bnN1YnNjcmliZQ==>.
To unsubscribe from this group and all its topics, send an email to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at 
https://groups.google.com/group/kubernetes-users<http://antispam.high5.local:32224/?NDU0NzQyNGY1NjVlMGQwNjU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiZkNTYxZDVhNWQ1ZjFjMDU9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZ3JvdXAlMkZrdWJlcm5ldGVzLXVzZXJz>.
For more options, visit 
https://groups.google.com/d/optout<http://antispam.high5.local:32224/?NTg0MzQ1MTE0MjBiNGQ0ZTU9NThCOUMxMDdfODE3ODhfNTk1NF8xJiY2NDE1YzRjNDI0MTFkMDU9MTIzMyYmdXJsPWh0dHBzJTNBJTJGJTJGZ3JvdXBzJTJFZ29vZ2xlJTJFY29tJTJGZCUyRm9wdG91dA==>.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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