• 8

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have a small cluster on GKE, and I use dynamic provisioning to allocate persistent disks for Postgres. These disks are snapshotted on a regular schedule. When an accident happens, what's the best way to overwrite the contents of a dynamically created disk with the contents of a snapshot? I considered just deleting the disk and creating a new one with the same name, based on the snapshot. But since the disk is created and managed by k8s I'm worried that messing with it manually will break things.

I settled on creating a new instance, outside of k8s, attaching the target disk and a new one based on the snapshot to it, and using dd to copy the data, but this is much slower than I'd like it to be. (~38MB/s)

Is there a better way?

    • The dynamically provisioned persistent volumes are always deleted according to the reclaim policy, as such, I suggest first to create GCE persistent disk for Postgres data, and mount it in the deployment 1, 2. This will preserve the persistent disk when pods get restarted or rescheduled for reasons like crashes or node restarts.
      • 1
    • @EchoNolan Were you able to set up as per the Irina's suggestion or have found another way to set this up? If so, Please post the self-answer so to benefit the community having similar setup.

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags