Unable to access localhost from pushgateway pod on openshift

37 views
Skip to first unread message

Nidhi Sharma

unread,
Apr 29, 2020, 2:09:57 AM4/29/20
to Prometheus Users
Hi,
Do i need to make any config changes so that I can access localhost? Please help

Stuart Clark

unread,
Apr 29, 2020, 2:20:30 AM4/29/20
to Nidhi Sharma, Prometheus Users
When you are running an application inside a container "localhost" refers to the container, not the underlying host. You will need to use a different method to reference other pods, such as a service DNS name.

On 29 April 2020 07:09:56 BST, Nidhi Sharma <nidhish...@gmail.com> wrote:
Hi,
Do i need to make any config changes so that I can access localhost? Please help


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Nidhi Sharma

unread,
Apr 29, 2020, 3:20:54 AM4/29/20
to Prometheus Users
Thanks for replying Stuart. Even if I use service DNS, i can't access any API inside the pushgateway container. Below is the command. I get 404.

Stuart Clark

unread,
Apr 29, 2020, 8:30:54 AM4/29/20
to Nidhi Sharma, Prometheus Users
On 2020-04-29 08:20, Nidhi Sharma wrote:
> Thanks for replying Stuart. Even if I use service DNS, i can't access
> any API inside the pushgateway container. Below is the command. I get
> 404.
> wget http://eaa-platform-pushgateway:9091/api/v1/status
>

As you are getting a 404 it sounds like you are hitting the container
correctly. Have you enabled the web API using --web.enable-admin-api?

--
Stuart Clark

Nidhi Sharma

unread,
Apr 30, 2020, 4:23:24 AM4/30/20
to Prometheus Users
Yes. I tried setting this flag but the pod goes in crashloopbackoff. Below are my docker file and entrypoint.sh. 

 Docker file :

FROM prom/pushgateway:v0.9.0
LABEL maintainer "MYCOM OSI"


# Allowed: debug, info, warn, error
ENV LOGLEVEL=warn

ADD /entrypoint.sh /bin/entrypoint.sh
USER root
RUN chmod +x /bin/entrypoint.sh
USER 65534

ENTRYPOINT [ "/bin/entrypoint.sh" ]

Entrypoint.sh

#!/bin/sh
exec "/bin/pushgateway --log.level=warn --web.enable-lifecycle --web.enable-admin-api"

Please tell me if there is anything wrong in the syntax.

Brian Candler

unread,
Apr 30, 2020, 5:34:05 AM4/30/20
to Prometheus Users
On Thursday, 30 April 2020 09:23:24 UTC+1, Nidhi Sharma wrote:
Entrypoint.sh

#!/bin/sh
exec "/bin/pushgateway --log.level=warn --web.enable-lifecycle --web.enable-admin-api"


Remove the double quotes.

What you've written is to try to run a command whose filename is exactly that one long string, including spaces.

Nidhi Sharma

unread,
Apr 30, 2020, 7:56:00 AM4/30/20
to Prometheus Users
I commited below script now but still pod is in crashloop

#!/bin/sh
exec /bin/pushgateway --web.enable-lifecycle --web.enable-admin-api

Nidhi Sharma

unread,
Apr 30, 2020, 8:32:50 AM4/30/20
to Prometheus Users
Below is the ideal script when pod is working fine. If I try to include any flag here, i get crashloop pod

#!/bin/sh
/bin/pushgateway --log.level=$LOGLEVEL

Nidhi Sharma

unread,
May 4, 2020, 12:49:59 AM5/4/20
to Prometheus Users
RESOLVED. after changing the version of pushgateway in dockerfile
Reply all
Reply to author
Forward
0 new messages