Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto scaling issue with Prometheus container #2609

Closed
prasenforu opened this Issue Apr 11, 2017 · 12 comments

Comments

Projects
None yet
5 participants
@prasenforu
Copy link

prasenforu commented Apr 11, 2017

I am using Prometheus in kubernetes cluster using PVC (Persistent Volume Claim).

As single container its working fine but when I was trying to do autoscaling.

Its going to "CrashLoopBackOff" and in container logs I am getting following error

time="2017-04-11T13:23:52Z" level=info msg="Starting prometheus (version=1.1.1, branch=release-1.0, revision=ab312a075f810e2ed124783c46d68674af07193)" source="main.go:73"
time="2017-04-11T13:23:52Z" level=info msg="Build context (go=go1.6.3, user=root@8ab14ddb4898, date=20160907-09:37:01)" source="main.go:74"
time="2017-04-11T13:23:52Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" source="main.go:221"
time="2017-04-11T13:23:52Z" level=error msg="Could not lock /prometheus/DIRTY, Prometheus already running?" source="persistence.go:180"
time="2017-04-11T13:23:52Z" level=error msg="Error opening memory series storage: resource temporarily unavailable" source="main.go:158"
@sdurrheimer

This comment has been minimized.

Copy link
Member

sdurrheimer commented Apr 11, 2017

Does those auto-scaled prometheus use the same PVC ?

@prasenforu

This comment has been minimized.

Copy link
Author

prasenforu commented Apr 11, 2017

yes.

And in latest version also, same issue...

time="2017-04-11T15:02:49Z" level=info msg="Starting prometheus (version=1.5.2, branch=master, revision=bd1182d29f462c39544f94cc822830e1c64cf55b)" source="main.go:75"
time="2017-04-11T15:02:49Z" level=info msg="Build context (go=go1.7.5, user=root@1a01c5f68840, date=20170210-16:23:28)" source="main.go:76"
time="2017-04-11T15:02:49Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" source="main.go:248"
time="2017-04-11T15:02:49Z" level=error msg="Could not lock /prometheus/DIRTY, Prometheus already running?" source="persistence.go:198"
time="2017-04-11T15:02:49Z" level=error msg="Error opening memory series storage: resource temporarily unavailable" source="main.go:182"
@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Apr 11, 2017

So you are trying to run two Prometheus on the same data directory. If you want to scale you need to give each Prometheus instance a different directory.

In Prometheus scaling is done via Federation: https://prometheus.io/docs/operating/federation/

@prasenforu

This comment has been minimized.

Copy link
Author

prasenforu commented Apr 11, 2017

That's the challenge.

Because container are immutable. For any reason it may die. Till that time another container start my monitoring data lost.

If I have another container running with same data then there is nothing to lose of monitoring data.

I can not use different folder for other container

Please advise.

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Apr 11, 2017

For HA of Prometheus you can run two "independent" (As in on different folders/machines) Prometheuses which scrape the same targets. If one containers goes down, you can switch to the other without any loss.

See: https://prometheus.io/docs/introduction/faq/#can-prometheus-be-made-highly-available

@prasenforu

This comment has been minimized.

Copy link
Author

prasenforu commented Apr 11, 2017

That mean when two containers running, both have same data.

In kubernetes cluster we are not doing any manual switching, that is taken care by kubernetes itself.

I think due to present of database inside prometheus container its not allowing scale up with same pvc.

If my understanding is correct then need to rethink on this.

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Apr 11, 2017

As both Prometheuses are scraping the same targets, they hold more or less the same data.

@sdurrheimer

This comment has been minimized.

Copy link
Member

sdurrheimer commented Apr 11, 2017

Prometheus act as a stateful application, two instance can't use the same data directory.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Apr 11, 2017

You either want to look at using StatefulSets, which allow templating of PVCs that are instantiated dynamically or try out the prometheus-operator which handles a lot of those things for you.

@prasenforu

This comment has been minimized.

Copy link
Author

prasenforu commented Apr 13, 2017

By the way in prometheus container which folders need setup for Persistent Volume.

I use /var folder from container.

@empyrean987

This comment has been minimized.

Copy link

empyrean987 commented Jun 27, 2018

@prasenforu did you ever solve this issue?

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.