[kontinuity-dev-public] What's the IP Address of OpenShift Relative to a Running Pod?

Andrew Lee Rubinger alr at redhat.com
Tue Jun 7 15:43:39 UTC 2016


So basically "the local hostname 'openshift.default.svc.cluster.local'". :)

Works; thanks guys!

S,
ALR

On Tue, Jun 7, 2016 at 9:31 AM, Jorge Morales Pou <jmorales at redhat.com>
wrote:

> You can:
>
> TOKEN="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
> NAMESPACE="$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)"
> POD_NAME="$(echo $HOSTNAME)"
>
>
> $ curl --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
> "
> https://openshift.default.svc.cluster.local/api/v1/namespaces/${NAMESPACE}/pods/${POD_NAME}"
> \
> -H "Authorization: Bearer $TOKEN"
>
> And then you get the json where you can query for ".status.podIP"
>
> Not really fancy.
>
> Jorge Morales
> OpenShift by Red Hat
> EMEA Field Product Manager
> Product Marketing Manager
>
> On Tue, Jun 7, 2016 at 3:04 PM, Ben Parees <bparees at redhat.com> wrote:
>
>> Not sure when it was added, but you can also look at:
>> /var/run/secrets/kubernetes.io/serviceaccount/namespace
>>
>> to find the namespace.
>>
>>
>> On Tue, Jun 7, 2016 at 7:02 AM, Jorge Morales Pou <jmorales at redhat.com>
>> wrote:
>>
>>>
>>> http://stackoverflow.com/questions/31557932/how-to-get-the-namespace-from-inside-a-pod-in-openshift
>>>
>>> Jorge Morales
>>> OpenShift by Red Hat
>>> EMEA Field Product Manager
>>> Product Marketing Manager
>>>
>>> On Tue, Jun 7, 2016 at 11:12 AM, Andrew Lee Rubinger <alr at redhat.com>
>>> wrote:
>>>
>>>> Quick question in $subject.  Was expecting some OPENSHIFT_ADDRESS or
>>>> something environment variable passed into the Docker container when it
>>>> started but I don't see it listed.
>>>>
>>>> S,
>>>> ALR
>>>>
>>>> --
>>>> Red Hat Developer Programs Architecture
>>>> @ALRubinger
>>>>
>>>> _______________________________________________
>>>> kontinuity-dev-public mailing list
>>>> kontinuity-dev-public at redhat.com
>>>> https://www.redhat.com/mailman/listinfo/kontinuity-dev-public
>>>>
>>>>
>>>
>>> _______________________________________________
>>> kontinuity-dev-public mailing list
>>> kontinuity-dev-public at redhat.com
>>> https://www.redhat.com/mailman/listinfo/kontinuity-dev-public
>>>
>>>
>>
>>
>> --
>> Ben Parees | OpenShift
>>
>>
>


-- 
Red Hat Developer Programs Architecture
@ALRubinger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kontinuity-dev-public/attachments/20160607/dfa2819c/attachment.htm>


More information about the kontinuity-dev-public mailing list