pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Sudakov <vas@sibptus.ru>
To: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Running PostgreSQL in Kubernetes?
Date: Thu, 29 Jul 2021 16:20:54 +0700
Message-ID: <YQJy9p0WbWpXHeFr@admin.sibptus.ru> (raw)
In-Reply-To: <CAM+6J97yqWEnBO=GR6QA+-N6JiNFm+XW4H2ZtsnTsD95JfNHBg@mail.gmail.com>
References: <YP6QJja3b+2nZ3z7@admin.sibptus.ru>
	<CAM+6J97yqWEnBO=GR6QA+-N6JiNFm+XW4H2ZtsnTsD95JfNHBg@mail.gmail.com>

Vijaykumar Jain wrote:
> I am just asking in a different thread so as to not derail the original
> conversation.
> What was the real need to have postgresql cluster running in kubernetes?
> I have experience in apache mesos, and did some beginner tutorial in
> kubernetes, but in my case those were good for stateless services.
> For dbs, we used to have dedicated vms for postgresql clusters on lvm and
> vmware. It was very rare that we lost a physical server beyond recovery,

I think you may want to run Postgres in Kubernetes when your Postgres
clusters are cattle, not pets. For example, if you create and tear down
many Postgres clusters daily for testing or development purposes. Like,
a dedicated test Postgres DB for each commit in your CI/CD system.

If your database clusters are pets, I see no reason to run them in
Kubernetes. Maybe someone will prove me wrong and name some reasons.

> 
> Now with k8s, every time the server sneezes, the pods would get spawned
> onto different servers that would result in a full resync unless volumes
> could be moved.

Not actually. The core of both Zalando's and CrunchyData's operators is
Patroni which relies on Postgres' own physical replication. As soon as
the master Pod dies, a standby will be promoted by Patroni, the failover
process is really quick. You should setup some kind of anti-affinity so
that the leader and the standby Pods should not end up on the same node
though. At least I *hope* the operators work that way.

> Since containers are now in a shared environment, and if it is mostly over
> committed, then tuning of various params of a instance would be totally
> different compared to what was it on a dedicated vm.

Your other questions about shared resources in a Kubernetes cluster are
very interesting for me too. I hope someone can reply. I feel that the
degree of control you have over your Postgres cluster when it's running
on VMs (EC2 instances etc) cannot be achieved in Kubernetes.

[dd]
> 
> Maybe just like ssd, hdd, postgresql community would come up with a cost
> param to generate plans if run on k8s vs dedicated servers :).

I think Postgres itself can neither know no care if it's running in a Pod.
What tunables or cost params can you think of?

-- 
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet

Attachments:

  signature.asc (application/pgp-signature, 454B) download

view thread (12+ messages)  latest in thread

Message-ID: <YQJy9p0WbWpXHeFr@admin.sibptus.ru>
Permalink:  ../YQJy9p0WbWpXHeFr@admin.sibptus.ru/
Also on:    postgresql.org/message-id/YQJy9p0WbWpXHeFr@admin.sibptus.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: vas@sibptus.ru, vijaykumarjain.github@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Running PostgreSQL in Kubernetes?
  In-Reply-To: <YQJy9p0WbWpXHeFr@admin.sibptus.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox