[meta] use a deployment instead of a pod for babybuddy
diff --git a/meta/lotus-land-story/README.md b/meta/lotus-land-story/README.md
index b3d1a0d1..12351bb2 100644
--- a/meta/lotus-land-story/README.md
+++ b/meta/lotus-land-story/README.md
@@ -5,7 +5,7 @@
```
# Install tooling
-brew install helm kubernetes-cli terraform
+brew install kubernetes-cli terraform
# Bootstrapping
(cd bootstrap && terraform init && terraform apply)
@@ -20,6 +20,16 @@ terraform destroy
- https://learnk8s.io/terraform-lke
- https://cert-manager.io/docs/tutorials/acme/ingress/
+- https://www.linode.com/community/questions/20215/how-to-re-attach-persistent-volume-to-pod-when-claim-is-deleted
+
+ > At first I get new PVC uid by command:
+ > `kubectl get pvc my-pvc-0 -o yaml | grep uid`
+ > Then I edit new empty volume, what provisioned by CSI Driver and remove claim - pv binding by removing claimRef section in:
+ > `kubectl edit pv pvc-yyyyyyyyyyyy`
+ > After that new PV change status to "Available" and can be deleted.
+ > Then I edit old PV, what I want to bind with pod via new claim and put PVC uid to claimRef section:
+ > `kubectl edit pv pvc-xxxxxxxxxxx`
+ > After that, the old volume became associated with the new claim.
## TODO
diff --git a/meta/lotus-land-story/babybuddy.tf b/meta/lotus-land-story/babybuddy.tf
index d1d88e9a..6ad1eeeb 100644
--- a/meta/lotus-land-story/babybuddy.tf
+++ b/meta/lotus-land-story/babybuddy.tf
@@ -13,32 +13,77 @@ resource "kubernetes_persistent_volume_claim" "babybuddy" {
}
}
-resource "kubernetes_pod" "babybuddy" {
+# resource "kubernetes_pod" "babybuddy" {
+# metadata {
+# name = "babybuddy"
+# labels = {
+# app = "babybuddy"
+# }
+# }
+
+# spec {
+# container {
+# # https://github.com/babybuddy/babybuddy/issues/337
+# image = "lscr.io/linuxserver/babybuddy:v1.9.0-ls14"
+# image_pull_policy = "Always"
+# name = "babybuddy"
+# port {
+# container_port = 8000
+# }
+# volume_mount {
+# name = "babybuddy"
+# mount_path = "/config"
+# }
+# }
+# volume {
+# name = "babybuddy"
+# persistent_volume_claim {
+# claim_name = "babybuddy"
+# }
+# }
+# }
+# }
+
+resource "kubernetes_deployment" "babybuddy" {
metadata {
name = "babybuddy"
- labels = {
- app = "babybuddy"
- }
}
spec {
- container {
- # https://github.com/babybuddy/babybuddy/issues/337
- image = "lscr.io/linuxserver/babybuddy:v1.9.0-ls14"
- image_pull_policy = "Always"
- name = "babybuddy"
- port {
- container_port = 8000
- }
- volume_mount {
- name = "babybuddy"
- mount_path = "/config"
+ selector {
+ match_labels = {
+ app = "babybuddy"
}
}
- volume {
- name = "babybuddy"
- persistent_volume_claim {
- claim_name = "babybuddy"
+ strategy {
+ type = "Recreate"
+ }
+ template {
+ metadata {
+ labels = {
+ app = "babybuddy"
+ }
+ }
+ spec {
+ container {
+ # https://github.com/babybuddy/babybuddy/issues/337
+ image = "lscr.io/linuxserver/babybuddy:v1.9.0-ls14"
+ name = "babybuddy"
+ image_pull_policy = "Always"
+ port {
+ container_port = 8000
+ }
+ volume_mount {
+ name = "babybuddy"
+ mount_path = "/config"
+ }
+ }
+ volume {
+ name = "babybuddy"
+ persistent_volume_claim {
+ claim_name = "babybuddy"
+ }
+ }
}
}
}