PostgreSQL and Kubernetes

Started by Moreno Andreoabout 9 years ago9 messagesgeneral
Jump to latest
#1Moreno Andreo
moreno.andreo@evolu-s.it

<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
Hi everyone,<br>
    I was googling around while searching stuff to finish my cluster
solution (already running in production in single-server mode) with
barman and pgbouncer, when I ran into this<br>
<br>
<a class="moz-txt-link-freetext" href="https://hackernoon.com/postgresql-cluster-into-kubernetes-cluster-f353cde212de&quot;&gt;https://hackernoon.com/postgresql-cluster-into-kubernetes-cluster-f353cde212de&lt;/a&gt;&lt;br&gt;
<br>
Since I'm on Google Cloud Platform, I thought it would be a good
idea to see what it offers. After a quick read, I found a comment
saying <br>
<b>"There was a series of comments by Kelsey Hightower about running
databases in Kubernetes, both at conferences and on Twitter; he
essentially says that you should absolutely NOT run your database
in a container/kubernetes pod/service/deployment, as databases
aren't built for type of dynamic scheduling that something like
kubernetes (or any other container management solution), due to
how they interact with the filesystem, network stack, and more.</b><br>
<b>Further more, he suggests that because of this lack of
integration, that if you do run your database in
kubernetes/docker, you are very likely to encounter data
corruption and data loss"</b><br>
<br>
What's your advice?<br>
Thanks in advance,<br>
Moreno<br>
</body>
</html>

#2Vick Khera
vivek@khera.org
In reply to: Moreno Andreo (#1)
Re: PostgreSQL and Kubernetes

On Thu, Mar 30, 2017 at 6:10 AM, Moreno Andreo <moreno.andreo@evolu-s.it>
wrote:

Since I'm on Google Cloud Platform, I thought it would be a good idea to
see what it offers.

They currently have in beta a Postgres flavor of their cloudsql. I haven't
used it yet, but I plan to test it sometime in the next couple of months.

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Moreno Andreo (#1)
Re: PostgreSQL and Kubernetes

On 03/30/2017 03:10 AM, Moreno Andreo wrote:

Hi everyone,
I was googling around while searching stuff to finish my cluster
solution (already running in production in single-server mode) with
barman and pgbouncer, when I ran into this

https://hackernoon.com/postgresql-cluster-into-kubernetes-cluster-f353cde212de

Since I'm on Google Cloud Platform, I thought it would be a good idea to
see what it offers. After a quick read, I found a comment saying
*"There was a series of comments by Kelsey Hightower about running
databases in Kubernetes, both at conferences and on Twitter; he
essentially says that you should absolutely NOT run your database in a
container/kubernetes pod/service/deployment, as databases aren't built
for type of dynamic scheduling that something like kubernetes (or any
other container management solution), due to how they interact with the
filesystem, network stack, and more.*
*Further more, he suggests that because of this lack of integration,
that if you do run your database in kubernetes/docker, you are very
likely to encounter data corruption and data loss"*

What's your advice?

I don't us eKubernetes, but I do know one of the former members of the
Postgres Core does:

https://opensource.com/article/17/2/stateful-applications

and delivered a talk at Scale15x on it:

http://www.socallinuxexpo.org/scale/15x/presentations/ccp-containerized-clustered-postgres

https://www.youtube.com/watch?v=mxmZv9xkc8s

Go to about 3 minutes in on the video as there are sound/video issues
before that.

Thanks in advance,
Moreno

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Moreno Andreo
moreno.andreo@evolu-s.it
In reply to: Adrian Klaver (#3)
Re: PostgreSQL and Kubernetes

Il 30/03/2017 15:27, Adrian Klaver ha scritto:

On 03/30/2017 03:10 AM, Moreno Andreo wrote:

Hi everyone,
I was googling around while searching stuff to finish my cluster
solution (already running in production in single-server mode) with
barman and pgbouncer, when I ran into this

https://hackernoon.com/postgresql-cluster-into-kubernetes-cluster-f353cde212de

Since I'm on Google Cloud Platform, I thought it would be a good idea to
see what it offers.

[snip]

What's your advice?

I don't us eKubernetes,

neither do I, at the moment..... but if there's to dig into something
new, I'm always ready!

but I do know one of the former members of the Postgres Core does:

https://opensource.com/article/17/2/stateful-applications

That's a *niiice* article!

and delivered a talk at Scale15x on it:

http://www.socallinuxexpo.org/scale/15x/presentations/ccp-containerized-clustered-postgres

https://www.youtube.com/watch?v=mxmZv9xkc8s

I'll take a look later........

Thanks a lot!!!
Best regards
Moreno.

Go to about 3 minutes in on the video as there are sound/video issues
before that.

Thanks in advance,
Moreno

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Moreno Andreo
moreno.andreo@evolu-s.it
In reply to: Vick Khera (#2)
Re: PostgreSQL and Kubernetes

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Il 30/03/2017 14:38, Vick Khera ha
scritto:<br>
</div>
<blockquote
cite="mid:CALd+dceS+9vhTQGZtAfKYZHzZuY8yJbKmcU8dZR+rBVchaDNqQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Mar 30, 2017 at 6:10 AM,
Moreno Andreo <span dir="ltr">&lt;<a moz-do-not-send="true"
href="mailto:moreno.andreo@evolu-s.it" target="_blank">moreno.andreo@evolu-s.it</a>&gt;</span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Since
I'm on Google Cloud Platform, I thought it would be a good
idea to see what it offers. </blockquote>
</div>
<br>
They currently have in beta a Postgres flavor of their
cloudsql. I haven't used it yet, but I plan to test it
sometime in the next couple of months.</div>
</div>
</blockquote>
<p>I'm aware of this (and I'm about to test it too), but while this
is in beta I need a solution to keep up with my architecture... I
can't stay with a single server and no backup (except a snapshot
of the disk made on a daily basis... but that's no real backup)
waiting for Cloud SQL to get out of beta...<br>
</p>
</body>
</html>

#6Joe Conway
mail@joeconway.com
In reply to: Moreno Andreo (#5)
Re: PostgreSQL and Kubernetes

On 03/31/2017 01:58 AM, Moreno Andreo wrote:

Il 30/03/2017 14:38, Vick Khera ha scritto:

On Thu, Mar 30, 2017 at 6:10 AM, Moreno Andreo
<moreno.andreo@evolu-s.it <mailto:moreno.andreo@evolu-s.it>> wrote:

Since I'm on Google Cloud Platform, I thought it would be a good
idea to see what it offers.

They currently have in beta a Postgres flavor of their cloudsql. I
haven't used it yet, but I plan to test it sometime in the next couple
of months.

I'm aware of this (and I'm about to test it too), but while this is in
beta I need a solution to keep up with my architecture... I can't stay
with a single server and no backup (except a snapshot of the disk made
on a daily basis... but that's no real backup) waiting for Cloud SQL to
get out of beta...

Take a look at:
https://github.com/CrunchyData/crunchy-containers

HTH,

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

#7Alexey Klyukin
alexk@commandprompt.com
In reply to: Moreno Andreo (#1)
Re: PostgreSQL and Kubernetes

On 30. Mar 2017, at 12:10, Moreno Andreo <moreno.andreo@evolu-s.it> wrote:

as databases aren't built for type of dynamic scheduling that something like kubernetes (or any other container management solution), due to how they interact with the filesystem, network stack, and more.
Further more, he suggests that because of this lack of integration, that if you do run your database in kubernetes/docker, you are very likely to encounter data corruption and data loss"

What's your advice?

I think dynamic scheduling just increases the chances of your database instance being killed. Your K8S cluster, if not configured properly, may decide to kill your master database pod when scaling down nodes in order to utilise resources efficiently.

If you run your PostgreSQL on K8S make sure you have a good and battle-tested HA setup, know your way around configuring both PostgreSQL streaming replication and Kubernetes cluster, and have a number of databases to manage, as it makes little sense to build an aircraft carrier to carry a single Cessna.

Kind regards,
--
Oleksii “Alex" Kliukin

#8Moreno Andreo
moreno.andreo@evolu-s.it
In reply to: Joe Conway (#6)
Re: PostgreSQL and Kubernetes

Il 03/04/2017 18:10, Joe Conway ha scritto:

On 03/31/2017 01:58 AM, Moreno Andreo wrote:

Il 30/03/2017 14:38, Vick Khera ha scritto:

On Thu, Mar 30, 2017 at 6:10 AM, Moreno Andreo
<moreno.andreo@evolu-s.it <mailto:moreno.andreo@evolu-s.it>> wrote:

Since I'm on Google Cloud Platform, I thought it would be a good
idea to see what it offers.

They currently have in beta a Postgres flavor of their cloudsql. I
haven't used it yet, but I plan to test it sometime in the next couple
of months.

I'm aware of this (and I'm about to test it too), but while this is in
beta I need a solution to keep up with my architecture... I can't stay
with a single server and no backup (except a snapshot of the disk made
on a daily basis... but that's no real backup) waiting for Cloud SQL to
get out of beta...

Take a look at:
https://github.com/CrunchyData/crunchy-containers

This is another good post... but I decided to keep the current
architecture, adding a standby server managed by repmgr and load
balanced by PgPool II, with barman taking care of the backup. I don't
think spending more than a week studying the docs and preparing the
whole thing in test lab.

If I'm about to migrate to Cloud SQL I think it's not worth the effort
to create a new structure and migrate in there, just for some time...
and then migrate again to CloudSQL.

Thanks again
Moreno.-

HTH,

Joe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#9Moreno Andreo
moreno.andreo@evolu-s.it
In reply to: Alexey Klyukin (#7)
Re: PostgreSQL and Kubernetes

<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Il 03/04/2017 22:32, Alex Kliukin ha
scritto:<br>
</div>
<blockquote
cite="mid:017754FC-F0C0-42AA-9A8F-E1F4F13AC052@hintbits.com"
type="cite">as it makes little sense to build an aircraft carrier
to carry a single Cessna. <br>
</blockquote>
:-) A bit extreme, but it makes the idea ...<br>
Thanks<br>
Moreno.-<br>
<blockquote
cite="mid:017754FC-F0C0-42AA-9A8F-E1F4F13AC052@hintbits.com"
type="cite">
<div><br class="">
</div>
<div> </div>
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap:
break-word; -webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;" class="">Kind
regards,</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;" class="">--</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;" class="">Oleksii
“Alex" Kliukin</div>
</div>
</div>
<br class="">
</blockquote>
<p><br>
</p>
</body>
</html>