Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[Longhorn/Storage] Install Longhorn on Kubernetes through helm and config Taints and Tolerations

Posted on August 24, 2021June 27, 2023 By nim No Comments on [Longhorn/Storage] Install Longhorn on Kubernetes through helm and config Taints and Tolerations

Contents

Toggle
  • 1) Intall Longhorn by helm
  • 2) Overview and material references
  • 3) Practice – update Sat 23 Oct 2021
  • Issues of Longhorn.
    • MountVolume.MountDevice failed for volume — bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program

1) Intall Longhorn by helm

https://longhorn.io/docs/1.1.2/deploy/install/install-with-helm/

helm repo add longhorn https://charts.longhorn.io
kubectl create namespace longhorn-system
helm install longhorn longhorn/longhorn --namespace longhorn-system

Nếu bạn có cluster có nhưng node chạy SSD và bạn muốn longhorn được deploy trên đó thì làm theo mình

Taints and Tolerations Usage with Node Selector in Kubernetes Scheduling
kubectl label nodes k8s-worker-storage1 node=storage-ssd
kubectl taint node k8s-worker-storage1 node=storage-ssd:NoSchedule

Tham khảo bài viết trên để hiều tains and tolerations node

sử value này cho helm

longhornManager:
  tolerations:
    - key: "node"
      operator: "Equal"
      value: "storage-ssd"
      effect: "NoSchedule"
  nodeSelector:
    node: "storage-ssd"

longhornDriver:
  tolerations:
    - key: "node"
      operator: "Equal"
      value: "storage-ssd"
      effect: "NoSchedule"
  nodeSelector:
    node: "storage-ssd"

longhornUI:
  tolerations:
    - key: "node"
      operator: "Equal"
      value: "storage-ssd"
      effect: "NoSchedule"
  nodeSelector:
    node: "storage-ssd"

2) Overview and material references

sau khi deploy xong thì kiểm tra

Ok đã đúng node mong muốn

Tiện mà mình rút ra:

  • Quản lý, tạo, xoá PV và PVC rất tiện và dễ thực hiện.
  • Dynamically provision persistent volumes in Kubernetes: rất tiện cho anh/em khi cài app thông qua helm, không phải suy nghĩ nên tạo pvc và pv như thế nào.

Có video hướng dẫn luôn nhé! mọi người coi để thấy cách control longhorn như thế nào

3) Practice – update Sat 23 Oct 2021

Như trước thì mình sẽ cần tạo pv, rồi tạo pvc
Giờ nhẹ nhàng hơn bạn chỉ apply pvc với storageClass là longhorn

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  labels:
    name: jenkins-permanent
  name: jenkins-permanent
spec:
  storageClassName: longhorn
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "8Gi"

4) Upgrade longhorn

Issues of Longhorn.

MountVolume.MountDevice failed for volume — bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program

MountVolume.MountDevice failed for volume "pvc-f7c230ba-57cd-4147-a902-0fe075060b53" : rpc error: code = Internal desc = mount failed: exit status 32 Mounting command: /usr/local/sbin/nsmounter Mounting arguments: mount -t nfs -o vers=4.1,noresvport,intr,hard 10.111.151.228:/pvc-f7c230ba-57cd-4147-a902-0fe075060b53 /var/lib/k0s/kubelet/plugins/kubernetes.io/csi/driver.longhorn.io/02764390c733a2577940cd8ae3d7da38a5839b94f4ace49a3a5b6f138cf05518/globalmount Output: mount: /var/lib/k0s/kubelet/plugins/kubernetes.io/csi/driver.longhorn.io/02764390c733a2577940cd8ae3d7da38a5839b94f4ace49a3a5b6f138cf05518/globalmount: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

Nếu gặp lỗi trên thì bạn thực hiện cài đặt.

sudo apt install nfs-common
sudo apt install cifs-utils

Sau đó restart server.

Kubernetes & Container, Longhorn - Storage

Post navigation

Previous Post: [Keycloak/OAuth2] Install Keycloak by helm on Kubernetes
Next Post: [issue/alpine] docker 20.10.2 -> golang:1-alpine3.14 error: make: go: Operation not permitted

More Related Articles

[Kaniko/Jenkins] Install Jenkins through helm and build/deploy app in K8s by Kaniko CI/CD
[letsencrypt] DST Root CA X3 Expiration (September 2021) BareMetal
[wordpress] Install WordPress so easily. Kubernetes & Container
[Helm Chart] Learning Helm on Kubernetes in 60 minutes!! Helm Chart
[issue/alpine] docker 20.10.2 -> golang:1-alpine3.14 error: make: go: Operation not permitted Docker
[Kubernetes] Lesson5: k8s easy – Multi-container, Probes Kubernetes & Container

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Laravel] Laravel Helpful June 26, 2025
  • [VScode] Hướng dẫn điều chỉnh font cho terminal June 20, 2025
  • [WordPress] Hướng dấn gửi mail trên WordPress thông qua gmail. June 15, 2025
  • [Bitbucket] Git Clone/Pull/Push with Bitbucket through API Token. June 12, 2025
  • [Teamcity] How to transfer the value from pipeline A to pipeline B June 9, 2025

Archives

  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.