{"id":2019,"date":"2024-09-25T18:23:55","date_gmt":"2024-09-25T09:23:55","guid":{"rendered":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/?p=2019"},"modified":"2024-09-25T18:23:55","modified_gmt":"2024-09-25T09:23:55","slug":"cloudnative-pg%e3%82%92%e5%b0%8e%e5%85%a5%e3%81%97%e3%82%88%e3%81%86%e3%81%a8%e3%81%97%e3%81%a6%e8%be%9e%e3%82%81%e3%81%9f%e8%a9%b1","status":"publish","type":"post","link":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/?p=2019","title":{"rendered":"CloudNative PG\u3092\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u8f9e\u3081\u305f\u8a71"},"content":{"rendered":"\n<p>CloudNative PG\u3068\u3044\u3046PostgreSQL\u306eoperator\u3092\u81ea\u5b85\u3067\u52d5\u304b\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u7528\u306b\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u8f9e\u3081\u305f\u8a71\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>\u6700\u521d\u306b\u8f9e\u3081\u305f\u7406\u7531\u306a\u3069\u3092\u7c21\u5358\u306b\u307e\u3068\u3081\u3066\u304a\u304f\u3068<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u81ea\u5b85\u306ek8s\u30af\u30e9\u30b9\u30bf\u306e\u53ef\u7528\u6027\u306a\u3069\u3092\u8003\u3048\u308b\u3068PersistentVolumeClain(PVC)\u3092\u9759\u7684\u306b\u4f5c\u6210\u3057\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306a\u3069\u3092\u624b\u52d5\u3067\u5b9f\u65bd\u3059\u308b\u307b\u3046\u304c\u5b89\u5fc3<\/li>\n\n\n\n<li>CloudNative PG\u306fPVC\u3092\u9759\u7684\u306b\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u306f\u3042\u307e\u308a\u63a8\u5968\u3055\u308c\u3066\u3044\u306a\u3044<\/li>\n\n\n\n<li>Cluster\u3092\u524a\u9664\u3059\u308b\u3068PVC\u3082\u4e00\u7dd2\u306b\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046<\/li>\n<\/ul>\n\n\n\n<p>\u4e0a\u8a18\u306e\u7406\u7531\u3067\u63a1\u7528\u3092\u898b\u9001\u308a\u307e\u3057\u305f\u3002\u30ef\u30fc\u30af\u30a2\u30e9\u30a6\u30f3\u30c9\u306a\u3069\u3082\u3042\u308b\u306e\u3067\u3059\u304c\u624b\u9593\u304c\u5897\u3048\u308b\u3057\u3001\u5b89\u5168\u30fb\u78ba\u5b9f\u306a\u65b9\u6cd5\u306f\u306a\u3055\u305d\u3046\u306a\u306e\u3067\u8ae6\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7d4c\u7def<\/h2>\n\n\n\n<p>\u73fe\u5728\u3001\u81ea\u5b85\u306ek8s\u3067\u8272\u3005\u30a2\u30d7\u30ea\u3092\u52d5\u304b\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u57fa\u672c\u7684\u306bStatefulset\u3092\u4f5c\u3063\u3066\u500b\u5225\u306bPostgreSQL\u3092\u7acb\u3066\u308b\u3088\u3046\u306a\u904b\u7528\u3092\u5b9f\u65bd\u3057\u3066\u3044\u307e\u3059\u3002\u5927\u304d\u306a\u4e0d\u6e80\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u4f5c\u6210\u3059\u308b\u306a\u3069\u306e\u5b9a\u671f\u4f5c\u696d\u306e\u305f\u3081\u306bCronJob\u3092\u4f5c\u6210\u3057\u305f\u308a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>CloudNative PG\u3092\u5c0e\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u3089\u306ePostgreSQL\u3092\u4fdd\u5b88\u3059\u308b\u624b\u9593\u3092\u524a\u6e1b\u3057\u305f\u3044\u3068\u8003\u3048\u3066\u5c0e\u5165\u3067\u304d\u306a\u3044\u304b\u3068\u691c\u8a0e\u3092\u59cb\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CloudNative PG\u306e\u5229\u7528\u65b9\u6cd5<\/h2>\n\n\n\n<p>CloudNative PG\u81ea\u4f53\u306fHelm\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u5c0e\u5165\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3067\u5c0e\u5165\u3057\u307e\u3057\u305f\u3002<br>\u3053\u308c\u306f\u516c\u5f0f\u306e<a href=\"https:\/\/github.com\/cloudnative-pg\/charts?tab=readme-ov-file#operator-chart\" data-type=\"link\" data-id=\"https:\/\/github.com\/cloudnative-pg\/charts?tab=readme-ov-file#operator-chart\" target=\"_blank\" rel=\"noreferrer noopener\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806<\/a>\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>helm repo add cnpg https:\/\/cloudnative-pg.github.io\/charts\nhelm upgrade --install cnpg \\\n  --namespace cnpg-system \\\n  --create-namespace \\\n  cnpg\/cloudnative-pg<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3067\u3001operator\u306e\u5c0e\u5165\u304c\u51fa\u6765\u305f\u306e\u3067\u3001\u3042\u3068\u306f Cluster \u3068\u3044\u3046 CustomResource\u3092\u4f5c\u6210\u3059\u308b\u3068PostgreSQL\u3092CloudNative PG\u304c\u4f5c\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u30af\u30e9\u30b9\u30bf\u69cb\u6210\u3084\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u8a2d\u5b9a\u306a\u3069\u69d8\u3005\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059(\u8a73\u7d30\u306f<a href=\"https:\/\/cloudnative-pg.io\/documentation\/1.24\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044)\u3002\u624b\u52d5\u3067\u540c\u69d8\u306e\u3082\u306e\u3092\u69cb\u7bc9\u3059\u308b\u306e\u306f\u5927\u5909\u306a\u306e\u3067\u624b\u8efd\u306b\u69cb\u7bc9\u3067\u304d\u308b\u306e\u306f\u975e\u5e38\u306b\u3042\u308a\u304c\u305f\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u30de\u30cb\u30d5\u30a7\u30b9\u30c8\u30673\u53f0\u306e\u30af\u30e9\u30b9\u30bf\u3067\u305d\u308c\u305e\u308c\u306b1GB\u306e\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u4fdd\u6709\u3057\u3066\u3044\u308bPostgreSQL\u3092\u7a3c\u50cd\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: postgresql.cnpg.io\/v1\nkind: Cluster\nmetadata:\n  name: cluster-example\nspec:\n  instances: 3\n\n  storage:\n    size: 1Gi<\/code><\/pre>\n\n\n\n<p>\u3053\u3053\u307e\u3067\u306f\u4fbf\u5229\u3060\u306a\u3068\u601d\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u30b9\u30c8\u30ec\u30fc\u30b8\u56de\u308a\u3092\u8abf\u3079\u59cb\u3081\u308b\u3068\u3061\u3087\u3063\u3068\u81ea\u5206\u306e\u7528\u9014\u306b\u5408\u308f\u306a\u3044\u3068\u3053\u308d\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9759\u7684\u306b\u4f5c\u3063\u305fPVC\u3067\u904b\u7528\u3057\u305f\u3044<\/h2>\n\n\n\n<p>CloudNative PG\u306f\u8d77\u52d5\u3059\u308b\u3068\u81ea\u52d5\u7684\u306bPVC\u3092\u4f5c\u3063\u3066\u52d5\u7684\u306b\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u78ba\u4fdd\u3059\u308b\u3053\u3068\u3092\u524d\u63d0\u3068\u3057\u3066\u3044\u307e\u3059\u3002\u305f\u3060\u3001\u9759\u7684\u306b\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u78ba\u4fdd\u3057\u3066\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3082\u60f3\u5b9a\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<a href=\"https:\/\/cloudnative-pg.io\/documentation\/1.24\/storage\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u516c\u5f0f\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306b\u3082\u305d\u306e\u3088\u3046\u306a\u8a18\u8f09\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u81ea\u5b85\u306ek8s\u306fdynamic provisioning\u306evolume\u3082\u4f5c\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u52d5\u4f5c\u306f\u554f\u984c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u65b9\u91dd\u3068\u3057\u3066dynamic provision\u3055\u308c\u305f\u30b9\u30c8\u30ec\u30fc\u30b8\u306f\u6c38\u7d9a\u306e\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u3057\u305f\u304f\u306a\u3044\u306a\u3068\u3044\u3046\u6c17\u6301\u3061\u304c\u3042\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306a\u3082\u306e\u306b\u306fdynamic provision\u3067\u69cb\u308f\u306a\u3044\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u8272\u3005\u7406\u7531\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u4e3b\u8981\u306a\u7406\u7531\u3068\u3057\u3066\u306f\u6545\u969c\u6642\u306e\u30b5\u30eb\u30d9\u30fc\u30b8\u304c\u9762\u5012\u304f\u3055\u3044\u3053\u3068\u3067\u3059\u3002\u52d5\u7684\u306b\u78ba\u4fdd\u3055\u308c\u305fvolume\u306e\u5b9f\u4f53\u306buuid\u306a\u3069\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3001\u3057\u304b\u3082\u3069\u308c\u304c\u6700\u65b0\u306e\u3082\u306e\u306a\u306e\u304b\u5224\u65ad\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u3067\u3059\u3002CloudNative PG\u306e\u3088\u3046\u306b\u6b21\u3005\u306bPVC\u3092\u4f5c\u308b\u3088\u3046\u306a\u65b9\u91dd\u3060\u3068\u5927\u91cf\u306bPVC\u304c\u4f5c\u3089\u308c\u3066\u3057\u307e\u3063\u3066\u6545\u969c\u3057\u305f\u3068\u304d\u306a\u3069\u306b\u5fa9\u65e7\u3055\u305b\u3088\u3046\u3068\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u907f\u3051\u305f\u3044\u306a\u3068\u8003\u3048\u305f\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u53ef\u80fd\u3067\u3042\u308c\u3070PVC\u3068PV\u3092\u4e8b\u524d\u306b\u56fa\u5b9a\u3067\u4f5c\u6210\u3057\u3066\u305d\u308c\u3092PostgreSQL\u306b\u4e0e\u3048\u308b\u5f62\u5f0f\u3092\u9078\u3073\u305f\u3044\u3067\u3059\u3002\u3053\u3046\u3044\u3046\u5f62\u3067\u3042\u308c\u3070PV\u304c\u56fa\u5b9a\u51fa\u6765\u3066\u3044\u308b\u306e\u3067PV\u3092\u500b\u5225\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3059\u308b\u4ed5\u7d44\u307f\u3092\u4f5c\u308a\u3053\u3093\u3060\u308a\u3001\u6545\u969c\u306a\u3069\u306e\u6642\u3082\u30b5\u30eb\u30d9\u30fc\u30b8\u3059\u3079\u304d\u30c7\u30fc\u30bf\u306e\u5728\u308a\u51e6\u304c\u3059\u3050\u306b\u5206\u304b\u3063\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9759\u7684PVC\u306e\u691c\u8a3c<\/h2>\n\n\n\n<p>\u306a\u3093\u3068\u3001\u30de\u30cb\u30e5\u30a2\u30eb\u306e\u901a\u308a\u306b\u9759\u7684\u306bPVC\u3092\u4f5c\u6210\u3057\u3066Cluster\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u8d77\u52d5\u3057\u307e\u305b\u3093\u3002<br>\u540c\u3058\u72b6\u6cc1\u306b\u3064\u3044\u3066\u306eIssue\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u3002<br><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/issues\/5235\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/issues\/5235<\/a><\/p>\n\n\n\n<p>\u30ed\u30b0\u306a\u3069\u3092\u898b\u3066\u3044\u308b\u3068Init\u51e6\u7406\u3060\u3051\u52d5\u3044\u3066\u4ee5\u964d\u306e\u51e6\u7406\u304c\u52d5\u3044\u3066\u3044\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<br>\u52d5\u7684\u306b\u78ba\u4fdd\u3057\u305f\u5834\u5408\u306ePVC\u3068\u306e\u5dee\u5206\u3092\u898b\u3066\u3044\u308b\u3068 annotation \u3084 label \u306b\u5dee\u5206\u304c\u3042\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002\u4e2d\u3067\u3082\u4ee5\u4e0b\u306e <code>cnpg.io\/nodeSerial<\/code> \u3068\u3044\u3046annotation\u306e\u6709\u7121\u304c\u5927\u304d\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cnpg.io\/nodeSerial: \"1\"<\/code><\/pre>\n\n\n\n<p>\u8a66\u3057\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u624b\u9806\u3067\u64cd\u4f5c\u3057\u3066\u307f\u308b\u3068\u7121\u4e8b\u8d77\u52d5\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>PVC+PV\u3092\u624b\u52d5\u4f5c\u6210<\/li>\n\n\n\n<li>Cluster\u3092\u8d77\u52d5<\/li>\n\n\n\n<li>Init\u51e6\u7406\u306e\u5b8c\u4e86\u3092\u5f85\u3064<\/li>\n\n\n\n<li>PVC\u306b <code>cnpg.io\/nodeSerial<\/code>\u3092\u4ed8\u4e0e<\/li>\n\n\n\n<li>Cluster\u3092\u518d\u8d77\u52d5<\/li>\n<\/ol>\n\n\n\n<p>\u307e\u305f\u3001annotation\u304c\u4ed8\u3044\u3066\u3044\u306a\u3044PVC\u306b\u5bfe\u3057\u3066\u3001Init\u51e6\u7406\u8907\u6570\u56de\u5b9f\u884c\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u4e2d\u3092\u898b\u308b\u3068PostgreSQL\u306e\u30c7\u30fc\u30bf(PGDATA)\u304c\u8907\u6570\u4f5c\u3089\u308c\u3066\u3044\u308b\u3088\u3046\u306a\u72b6\u614b\u306b\u306a\u3063\u305f\u308a\u3082\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3055\u3089\u306b\u3001Cluster\u3092\u524a\u9664\u3059\u308b\u3068PVC\u304c\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002reclaimPolicy\u3092retain\u306b\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u30c7\u30fc\u30bf\u304c\u30ed\u30b9\u30c8\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u907f\u3051\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5168\u4f53\u7684\u306b\u4f55\u6545\u305d\u3093\u306a\u6319\u52d5\u306b\u306a\u308b\u306e\u304b\u7406\u89e3\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067CloudNativePG\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8aad\u3080\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u8abf\u67fb<\/h2>\n\n\n\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u7701\u304d\u307e\u3059\u304c\u3001CloudNative PG\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u52d5\u4f5c\u3092\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cluster\u306e\u72b6\u6cc1\u3092\u5e38\u306b\u898b\u5f35\u3063\u3066\u3044\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9(<a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/internal\/controller\/cluster_controller.go\">cluster_controller<\/a>)\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b<\/li>\n\n\n\n<li>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306eReconcile\u95a2\u6570\u306b\u3088\u3063\u3066\u30af\u30e9\u30b9\u30bf\u306e\u521d\u671f\u5316\u306a\u3069\u304c\u968f\u6642\u5b9f\u65bd\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\n<ul class=\"wp-block-list\">\n<li>PVC\u306e\u4f5c\u6210\u95a2\u9023\u306e\u51e6\u7406\n<ul class=\"wp-block-list\">\n<li>PVC\u304c\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u306f\u4f5c\u6210\u3059\u308b\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/pkg\/reconciler\/persistentvolumeclaim\/instance.go#L33-L42\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/pkg\/reconciler\/persistentvolumeclaim\/instance.go#L33-L42<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u4f5c\u6210\u3057\u305fPVC\u306b\u306flabel\u306a\u3069\u304c\u8a2d\u5b9a\u3055\u308c\u308b\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/pkg\/reconciler\/persistentvolumeclaim\/build.go#L43-L86\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/pkg\/reconciler\/persistentvolumeclaim\/build.go#L43-L86<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Init\u306e\u51e6\u7406\n<ul class=\"wp-block-list\">\n<li>createPrimaryInstance\u95a2\u6570\u3067init\u306e\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/internal\/controller\/cluster_controller.go#L834-L836\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/internal\/controller\/cluster_controller.go#L834-L836<\/a><\/li>\n\n\n\n<li>createPrimaryInstance\u3068\u3044\u3046\u540d\u524d\u306a\u306e\u306b\u3069\u3046\u3082Job\u3092\u4f5c\u6210\u3059\u308b\u3060\u3051\u306e\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u308b<\/li>\n\n\n\n<li>\u305d\u306eJob\u3067PostgreSQL\u306e\u521d\u671f\u5316\u51e6\u7406\u3092\u5b9f\u65bd\u3057\u3066\u3044\u308b\n<ul class=\"wp-block-list\">\n<li>\u3053\u306e\u4e2d\u3067\u65e2\u5b58\u306e\u30c7\u30fc\u30bf\u304c\u5b58\u5728\u3057\u3066\u3044\u305f\u3089\u305d\u308c\u3092\u5225\u540d\u4fdd\u5b58\u3057\u65b0\u3057\u304f\u4f5c\u6210\u3059\u308b\u3088\u3046\u306a\u51e6\u7406\u304c\u3042\u3063\u305f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Pod\u306e\u8d77\u52d5\u306e\u51e6\u7406\n<ul class=\"wp-block-list\">\n<li>CloudNative PG\u306fPod\u3092\u8d77\u52d5\u3059\u308b\u51e6\u7406\u3068\u3044\u3046\u306e\u306fpod\u306erecovery\u306e\u51e6\u7406\u3068\u306a\u3063\u3066\u3044\u308b\n<ul class=\"wp-block-list\">\n<li>\u4ee5\u4e0b\u306e2\u7a2e\u985e\u306b\u9055\u3044\u306f\u7121\u3044\u306e\u3067\u3053\u3046\u3044\u3046\u51e6\u7406\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308b\n<ul class=\"wp-block-list\">\n<li>init\u304c\u5b9f\u65bd\u3055\u308c\u305fPVC\u3092\u898b\u3064\u3051\u308b<\/li>\n\n\n\n<li>\u65e2\u306b\u904e\u53bb\u8d77\u52d5\u3055\u308c\u3066\u3044\u308bPVC\u3092\u8aad\u307f\u8fbc\u3080<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u5b9f\u969b\u306bPod\u3092\u8d77\u52d5\u3057\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308b\u306e\u306f\u4ee5\u4e0b\n<ul class=\"wp-block-list\">\n<li>ensureInstancesAreCreated\u95a2\u6570\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/internal\/controller\/cluster_create.go#L1300\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/main\/internal\/controller\/cluster_create.go#L1300<\/a><\/li>\n\n\n\n<li>\u3053\u306e\u4e2d\u3067findInstancePodToCreate\u304c\u547c\u3070\u308c\u3001\u305d\u306e\u4e2d\u3067\u8d77\u52d5\u306b\u4f7f\u3046PVC\u306e\u9078\u629e\u306a\u3069\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u672a\u6240\u5c5e\u306ePVC\u306fOrphanPVC\u3068\u3057\u3066OwnerReference\u306a\u3069\u304c\u8a2d\u5b9a\u3055\u308c\u308b\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/037da6f9848b87d6da674a3b28df47d2afae7a34\/internal\/controller\/cluster_restore.go#L38\">https:\/\/github.com\/cloudnative-pg\/cloudnative-pg\/blob\/037da6f9848b87d6da674a3b28df47d2afae7a34\/internal\/controller\/cluster_restore.go#L38<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u3053\u307e\u3067\u8aad\u3093\u3067\u9069\u5f53\u306b\u9759\u7684\u306aPVC\u3092\u4e0e\u3048\u3066\u3082\u52d5\u304b\u306a\u3044\u7406\u7531\u304c\u5206\u304b\u3063\u3066\u304d\u307e\u3057\u305f\u3002<br>ensureInstancesAreCreated\u306a\u3069\u3067\u8272\u3005\u306a\u7b87\u6240\u3067NodeSerial\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u7b87\u6240\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001CloudNative PG\u306e\u4e2d\u3067\u3053\u306eNodeSerial\u3092\u4ed8\u4e0e\u3057\u3066\u3044\u308b\u7b87\u6240\u306fCloudNative PG\u304c\u4f5c\u6210\u3057\u305fPVC\u3060\u3051\u3067\u3059\u3002<br>\u3053\u306eNodeSerial\u306fPostgreSQL\u3068\u5bfe\u5fdc\u3059\u308b\u3082\u306e\u306a\u306e\u3067\u3001CloudNative PG\u5074\u3067\u9069\u5f53\u306b\u632f\u308b\u308f\u3051\u306b\u3082\u3044\u304b\u305a\u3001\u30c7\u30fc\u30bf\u3092\u4e0e\u3048\u308b\u5074\u304c\u5f53\u7136\u77e5\u3063\u3066\u3044\u308b\u3082\u306e\u3068\u3044\u3046\u3053\u3068\u306a\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u3064\u307e\u308a\u3001\u524d\u9805\u3067\u3042\u3063\u305f <code>cnpg.io\/nodeSerial: \"1\"<\/code> \u3092\u4ed8\u4e0e\u3059\u308b\u3068\u8d77\u52d5\u3067\u304d\u308b\u3068\u3044\u3046\u306e\u306f\u3053\u306e\u305f\u3081\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u6b21\u306b Cluster\u3092\u524a\u9664\u3059\u308b\u3068PVC\u304c\u6d88\u3048\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u3064\u3044\u3066\u3082\u3001PVC\u3092\u898b\u3064\u3051\u308b\u3068\u304d(OrphanedPVC\u306e\u51e6\u7406\u306a\u3069\u3067)OwnerReference\u4ed8\u4e0e\u3059\u308b\u3088\u3046\u3067\u3059\u3002\u3053\u306eOwnerReference\u304c\u4ed8\u3044\u3066\u3044\u308b\u30ea\u30bd\u30fc\u30b9\u306fk8s\u4e0a\u3067\u306f\u4f9d\u5b58\u95a2\u4fc2\u304c\u3042\u308b\u3082\u306e\u3068\u3057\u3066\u6271\u308f\u308c\u524a\u9664\u3059\u308b\u3068\u304d\u306b\u4e00\u7dd2\u306b\u6d88\u3048\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br>PVC\u304b\u3089<code>kubectl edit<\/code> \u306a\u3069\u3067OwnerReference\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u3067\u4e00\u6642\u7684\u306b\u56de\u907f\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u3059\u304c\u3001\u518d\u5ea6\u8d77\u52d5\u3059\u308b\u3068\u518d\u5ea6OwnerReference\u3092\u4ed8\u4e0e\u3057\u3066\u3057\u307e\u3046\u305f\u3081\u6839\u672c\u7684\u306b\u306f\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002\u305d\u3082\u305d\u3082Onwer\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u3068CloudNative PG\u306fPVC\u3092\u6271\u304a\u3046\u3068\u3057\u306a\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3064\u307e\u308a\u3001CloudNative PG\u3092\u9069\u5207\u306b\u7ba1\u7406\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u4e8b\u9805\u306b\u6ce8\u610f\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cluster\u3092\u5b89\u6613\u306b\u524a\u9664\u3057\u3066\u306f\u306a\u3089\u306a\u3044\n<ul class=\"wp-block-list\">\n<li>\u4e00\u7dd2\u306bPVC\u304c\u5fc5\u305a\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067PersistentVolume\u304c\u4e00\u7dd2\u306b\u6d88\u3048\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u304b\u3001\u6d88\u3048\u3066\u3082\u56f0\u3089\u306a\u3044\u3088\u3046\u306a\u4ed5\u7d44\u307f\u3092\u691c\u8a0e\u3059\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>PVC\u3092\u624b\u52d5\u3067\u4e0e\u3048\u308b\u5834\u5408\u306f <code> cnpg.io\/nodeSerial<\/code> \u3092\u5fc5\u305a\u4ed8\u4e0e\u3059\u308b\n<ul class=\"wp-block-list\">\n<li>\u4ed8\u4e0e\u3057\u305f\u3089Init\u306e\u51e6\u7406\u304c\u52d5\u4f5c\u3057\u306a\u3044\u306e\u3067\u4ed8\u4e0e\u3059\u308b\u524d\u306bInit\u306e\u51e6\u7406\u3092\u5b9f\u65bd\u3059\u308b<\/li>\n\n\n\n<li>\u524d\u9805\u306b\u4e0a\u3052\u305f\u624b\u9806\u3067Cluster\u306b\u5b9f\u65bd\u3055\u305b\u308b\u306e\u304c\u624b\u8efd <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u7d50\u8ad6<\/h2>\n\n\n\n<p>CloudNative PG\u306ePVC\u5468\u308a\u306f\u3082\u3046\u5c11\u3057\u3053\u306a\u308c\u3066\u304b\u3089\u5c0e\u5165\u3092\u518d\u691c\u8a0e\u3057\u3088\u3046\u304b\u306a\u3068\u5224\u65ad\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>OwnerReference\u306b\u3064\u3044\u3066\u306f\u3082\u3046\u5c11\u3057\u826f\u3044\u65b9\u6cd5\u306f\u306a\u3044\u306e\u304b\u306a\u3068\u601d\u3063\u305f\u308a\u3057\u307e\u3059\u3002ArgoCD\u306a\u3069\u3092\u4f7f\u3063\u3066Cluster\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u3066\u3044\u308b\u3088\u3046\u306a\u72b6\u6cc1\u3060\u3068\u3001\u8272\u3005\u64cd\u4f5c\u3057\u305f\u7d50\u679cReplace\u3092\u9078\u629e\u3057\u3066Cluster\u3092\u4f5c\u308a\u76f4\u3057\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306a\u3069\u306bPVC\u304c\u6d88\u3048\u3066\u3057\u307e\u3063\u3066\u30c8\u30e9\u30d6\u30eb\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u305d\u3046\u3067\u3059\u3002Cluster\u3092\u4f5c\u308bHelm Chart\u3068\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u90e8\u5206\u3092\u5225Chart\u306b\u3057\u3066\u5225\u7ba1\u7406\u306b\u3059\u308b\u3068\u3044\u3046\u306e\u3082\u624b\u3067\u3059\u304c\u5c0f\u898f\u6a21\u306a\u30a2\u30d7\u30ea\u958b\u767a\u3067\u306f\u305d\u3053\u307e\u3067\u3084\u308a\u305f\u304f\u306a\u3044\u3068\u3044\u3046\u306e\u304c\u672c\u97f3\u3067\u3059\u3002<\/p>\n\n\n\n<p>PVC\u306e\u5229\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u305d\u3046\u3044\u3046\u3082\u306e\u3060\u3068\u8ae6\u3081\u3066Init\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u6700\u521d\u306b\u4f5c\u3063\u3066\u3057\u307e\u3048\u3070\u4ee5\u964d\u306f\u6c17\u306b\u3057\u306a\u3044\u3067\u904b\u7528\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u5206\u304b\u3063\u305f\u306e\u306f\u826f\u304b\u3063\u305f\u3067\u3059\u3002reclaimPolicy \u3092 retain \u306b\u3059\u308b\u3053\u3068\u304c\u5b88\u308c\u3066\u3044\u308b\u306e\u3067\u3042\u308c\u3070\u3001Cluster\u3092\u6d88\u3057\u3066\u3057\u307e\u3063\u3066\u3082PV\u306f\u6b8b\u308b\u306e\u3067\u3001PV\u306e claimRef \u3092\u4fee\u6b63\u3059\u308b\u3053\u3068\u3067\u518d\u5ea6\u8d77\u52d5\u3059\u308c\u3070\u30ea\u30ab\u30d0\u30ea\u3067\u304d\u308b\u3068\u3044\u3046\u306e\u306f\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u30ea\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u3082\u660e\u78ba\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u4eca\u56de\u306f\u691c\u8a0e\u5bfe\u8c61\u3067\u306f\u306a\u304b\u3063\u305f\u306e\u3067\u8abf\u67fb\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u304b\u3089\u30ec\u30b9\u30c8\u30a2\u3092\u6700\u521d\u306b\u3059\u308b\u524d\u63d0\u306e\u904b\u7528\u3067\u3042\u308c\u3070\u307e\u305f\u52d5\u4f5c\u304c\u9055\u3063\u3066\u904b\u7528\u306e\u65b9\u6cd5\u3082\u9055\u3046\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u305d\u3082\u305d\u3082\u9759\u7684PVC\u8f9e\u3081\u308c\u3070\u826f\u3044\u306e\u3067\u306f\u306a\u3044\u304b\uff1f<\/h2>\n\n\n\n<p>\u305d\u3082\u305d\u3082\u9759\u7684\u306bPVC\u3001PV\u3092\u4f5c\u6210\u3057\u305f\u3044\u7406\u7531\u304c dynamic provision \u3057\u3066\u3044\u308b Volume \u306e\u30b5\u30eb\u30d9\u30fc\u30b8\u306b\u95a2\u3059\u308b\u4e0d\u5b89\u304c\u524d\u63d0\u306b\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u3064\u3044\u3066\u4f55\u304b\u65b9\u91dd\u304c\u7acb\u3066\u3089\u308c\u308b\u306e\u3067\u3042\u308c\u3070 Cluster \u3092\u524a\u9664\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u904b\u7528\u306a\u3089\u5c0e\u5165\u53ef\u80fd\u3067\u306f\u3042\u308b\u306e\u3067\u3001\u672a\u6765\u3078\u306e\u5bbf\u984c\u306b\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CloudNative PG\u3068\u3044\u3046PostgreSQL\u306eoperator\u3092\u81ea\u5b85\u3067\u52d5\u304b\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u7528\u306b\u5c0e\u5165\u3057\u3088\u3046\u3068\u3057\u3066\u8f9e\u3081\u305f\u8a71\u3067\u3059\u3002 \u6982\u8981 \u6700\u521d\u306b\u8f9e\u3081\u305f\u7406\u7531\u306a\u3069\u3092\u7c21\u5358\u306b\u307e\u3068\u3081\u3066\u304a\u304f\u3068 \u4e0a\u8a18\u306e\u7406\u7531\u3067\u63a1\u7528\u3092\u898b\u9001\u308a\u307e\u3057\u305f\u3002\u30ef\u30fc\u2026 <span class=\"read-more\"><a href=\"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/?p=2019\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-2019","post","type-post","status-publish","format-standard","hentry","category-1"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4wwqG-wz","_links":{"self":[{"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/posts\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2019"}],"version-history":[{"count":71,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/posts\/2019\/revisions"}],"predecessor-version":[{"id":2090,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=\/wp\/v2\/posts\/2019\/revisions\/2090"}],"wp:attachment":[{"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/light-of-moe.ddo.jp\/~sakura\/diary\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}