-
Notifications
You must be signed in to change notification settings - Fork 0
feat: longhorn guide #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| --- | ||
| 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: | ||
|
|
||
| ```yaml title="my-longhorn-example.yaml" | ||
| # add-highlight-start | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: <name>-pvc | ||
| spec: | ||
| accessModes: | ||
| - ReadWriteOnce | ||
| storageClassName: longhorn-static | ||
| resources: | ||
| requests: | ||
| storage: <size> | ||
| # add-highlight-end | ||
| --- | ||
| kind: Pod | ||
| apiVersion: v1 | ||
| metadata: | ||
| name: my-longhorn-example-pod | ||
| namespace: <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: <name>-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` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.