From bdeb82aa115cd3665b0d88c66b175ab80c6e8951 Mon Sep 17 00:00:00 2001 From: Lorenzo Corallo Date: Thu, 3 Apr 2025 14:28:14 +0200 Subject: [PATCH 1/2] feat: longhorn guide --- docs/infrastructure/03-Guides/add-storage.md | 81 ++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 docs/infrastructure/03-Guides/add-storage.md diff --git a/docs/infrastructure/03-Guides/add-storage.md b/docs/infrastructure/03-Guides/add-storage.md new file mode 100644 index 0000000..974f0d2 --- /dev/null +++ b/docs/infrastructure/03-Guides/add-storage.md @@ -0,0 +1,81 @@ +--- +title: Add Storage +--- + +## Core Concepts + +Many applications and services need a physical volume or storage to store their data or configuration. +As you should know, we use AKS (Kubernetes) to host everything from databases to telegram bots. +In our AKS cluster we have (ATTOW) a single node (VM) `Standard_B2ms` which allows to attach only 4 disks, +one of which is the VM's disk itself. +This means that you can only attach 3 managed disks to the Cluster, resulting in limited deployable services. + +To solve this problem, we added [Longhorn](https://longhorn.io/) so that we can create multiple +[PVC](https://kubernetes.io/docs/concepts/storage/persistent-volumes) from the VM's disk +(ATTOW it's a 128GB Standard SSD). + +:::important +Longhorn is a handy tool to create multiple PVC/volumes without creating new disks, but this comes with degraded performance and stability. +If you want to deploy something critical like a production database, it's recommended to create a dedicated +[Managed Disk](https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview). +::: + +## Add a Longhorn volume + +First of all, you must login in [our Longhorn dashboard](https://longhorn.polinetwork.org) and check +how much space is available for scheduling a new volume. +:::tip +- `Schedulable` is space you can use to create new volumes +- `Reserved` is space reserved to the VM, not available to create new volumes + +How much `Reserved` space is configured in the `Node` page, but at least 20-25 GB is recommended. +::: + +Once you verified you have sufficient `Schedulable` space available, you can create the PVC in the k8s manifest: +This is a basic `SecretProviderClass` manifest: + +```yaml title="my-longhorn-example.yaml" +# add-highlight-start +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: -pvc +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn-static + resources: + requests: + storage: +# add-highlight-end +--- +kind: Pod +apiVersion: v1 +metadata: + name: my-longhorn-example-pod + namespace: +spec: + containers: + - name: busybox + image: registry.k8s.io/e2e-test-images/busybox:1.29-4 + command: + - '/bin/sleep' + - '10000' + # add-highlight-start + volumeMounts: + - name: my-volume # Name of the volume defined below + mountPath: /app/data # Where you need to mount the volume + # add-highlight-end +# add-highlight-start + volumes: + - name: my-volume # it can be whatever you want + persistentVolumeClaim: + claimName: -pvc # the name of the PVC defined above +# add-highlight-end +``` + +Parameters: +- `namespace` k8s namespace +- `name` should identify the app where the volume will be used +- `size` size of the volume. Check [resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory). + e.g. `300M`, `1Gi`, `200Mi` From 49e4fdf9e5fc50667f82edf6e51c1723d1dddedc Mon Sep 17 00:00:00 2001 From: Lorenzo Corallo Date: Thu, 3 Apr 2025 14:29:32 +0200 Subject: [PATCH 2/2] fix: remove line --- docs/infrastructure/03-Guides/add-storage.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/infrastructure/03-Guides/add-storage.md b/docs/infrastructure/03-Guides/add-storage.md index 974f0d2..874c8f8 100644 --- a/docs/infrastructure/03-Guides/add-storage.md +++ b/docs/infrastructure/03-Guides/add-storage.md @@ -32,7 +32,6 @@ How much `Reserved` space is configured in the `Node` page, but at least 20-25 G ::: Once you verified you have sufficient `Schedulable` space available, you can create the PVC in the k8s manifest: -This is a basic `SecretProviderClass` manifest: ```yaml title="my-longhorn-example.yaml" # add-highlight-start