Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m95S6-0004oa-2p for pgsql-admin@arkaria.postgresql.org; Thu, 29 Jul 2021 12:47:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m95S3-0000iB-RM for pgsql-admin@arkaria.postgresql.org; Thu, 29 Jul 2021 12:47:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m95S3-0000i3-IQ for pgsql-admin@lists.postgresql.org; Thu, 29 Jul 2021 12:47:51 +0000 Received: from mailout.quailmail.ca ([64.68.200.56] helo=mailout.easymail.ca) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m95Rv-0003Tj-3X for pgsql-admin@lists.postgresql.org; Thu, 29 Jul 2021 12:47:51 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 17ECF21B30; Thu, 29 Jul 2021 12:47:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo03-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo03-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5v9wIuV8JW9B; Thu, 29 Jul 2021 12:47:39 +0000 (UTC) Received: from smtpclient.apple (unknown [4.28.96.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id A0F1D21A15; Thu, 29 Jul 2021 12:47:39 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: Running PostgreSQL in Kubernetes? From: Scott Ribe In-Reply-To: Date: Thu, 29 Jul 2021 06:47:38 -0600 Cc: Victor Sudakov , Pgsql-admin Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Vijaykumar Jain X-Mailer: Apple Mail (2.3654.100.0.2.22) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > \On Jul 28, 2021, at 11:18 PM, Vijaykumar Jain = wrote: >=20 > What was the real need to have postgresql cluster running in = kubernetes? When you have everything else running in K8s, it's awkward to keep = around a cluster of VMs just for your db--and running on dedicated = hardware has its own tradeoffs. > 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. You either have shared network volumes (persistent volume claims in K8s = terminology), in which case the migrated server re-mounts the same = volume. Or you can use local storage in which case the servers are bound = to specific nodes with that storage and don't migrate (you have to = manage this a bit manually, and it's a tradeoff for likely = higher-performing storage). Also, what makes you think the server will "sneeze" often? I cannot = remember the last time postgres quit unexpectedly. > 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. We don't find params to be different, but we are not really = over-committed. > Noisy neighbour's, a typical heavy activity like a bot attack on some = services, which do not touch the db that is on the same server will have = a serious impact due to shortage of resources. This is not really different than VMs. You either are able to manage = this reasonably, or you need dedicated hardware. > in our case dns was under huge stress due to constant bouncing of = services and discovery compared to original monoliths but were not tuned = to handle that amount of changes and suffered stale cache lookups. For = apps it would be OK, as they implement circuit breakers , but intra pg = setup for barman or logical replication or pgbackrest would suffer a = longer outage ?=20 You needed to fix your services. If your DNS is overloaded because your = apps are moving so much, then something is terribly, terribly wrong. Any = way, your postgres instances certainly should not be moving, so stale = lookups should not be a problem, even in such a circumstance. > Lastly, shared resources resulting in a poor query plan, like slow = vacuuming may degrade the db. Shared resources can slow things down, but I have no experience of that = affecting what the appropriate query plan should be. > Now, I have 0 exp in kubernetes, but I tried to understand the basics = and found most of then similar to apache mesos. My use case was dbs grow = and they grow really fast so they cannot be the same as immutable = containers , but idk. Like when in need of a increased memory, it was OK = to have do that for a vm and reboot, but for a pod, there is a risk of = deployment and moving the instance on another server ? Or else all the = pods that server would get bounced? As discussed above, movement of pods is not the problem you think it is. = Network volumes, no problem moving; local storage, can't move.