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] Store label with longhorn in order to create many storage classes and have many storage styles “SSD, HDD, fast, slow”

Posted on November 6, 2021October 30, 2024 By nim 2 Comments on [Longhorn] Store label with longhorn in order to create many storage classes and have many storage styles “SSD, HDD, fast, slow”

Hiện tại của k8s của mình có tổng cộng 6 node: 3 node HDD và 3 node SDD

Bạn thấy mình đã đánh label ssd cho 3 node

giờ mình thực hiện đánh label cho các node HDD

kubectl label nodes k8s-worker-01 node=storage-hdd

Mình cũng đã hướng dẫn cái đặt longhorn:

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

Hồi trước thì ý tưởng của mình là tạo cụm là worker storage k8s chạy ssd và khi mà mình persistem volume thì mình sẽ chạy trên những con ssd đó.

Sau khi nâng cập HDD khá là ngon dành riêng các cho k8s và 3 con worker storage chạy nvme.
mình nảy ra ý định mình sẽ tạo nhiều storage class để chỉ định hdd và ssd.

Giờ bạn lấy value của longhorn he. Chỉ bạn tận rang luôn

helm repo add longhorn https://charts.longhorn.io
helm search repo longhorn
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME             	CHART VERSION	APP VERSION	DESCRIPTION                                       
longhorn/longhorn	1.2.2        	v1.2.2     	Longhorn is a distributed block storage system ...
helm show values longhorn/longhorn > longhorn.yaml

>>>tạo namespace.
kubectl create ns longhorn-system

Mục đích lấy value để sem họ cho chúng ta khai báo nodeAffinity trong helm charn hông?
và cuối cùng là ko thấy config liên quan đến nodeAffinity

Không quan tâm đến nodeAffinity, Mình change lại value.yaml deploy longhorn như sau.
longhornDriver và longhornDriver thì mình chỉ muốn cài lên HDD cho tiết kiệm.
longhornManager mình gắn thêm tolerations để deploy lên tất cả các node worker trong cum.

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

longhornDriver:
  nodeSelector:
    node: "storage-hdd"

longhornUI:
  nodeSelector:
    node: "storage-hdd"

sau khi sync trên argocd thì được như sau

https://www.gushiciku.cn/pl/gnQe/zh-tw
theo bài việt của anh trung của.

Mình sẽ tạo 2 phần vùng storage class là hdd và ssd.

Giờ mình tạo 1 storage class dành riêng cho ổ hdd

kind: StorageClass 
apiVersion: storage.k8s.io/v1 
metadata:
  name: longhorn-normal
provisioner: driver.longhorn.io 
parameters: 
  numberOfReplicas: "3" 
  staleReplicaTimeout: "480"
  diskSelector: "hdd" 
  nodeSelector: "normal"

Giờ tạo thử 1 pvc sem thế nào

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  labels:
    name: pvc-hdd
  name: pvc-hdd
spec:
  storageClassName: longhorn-normal
  accessModes:
    - "ReadWriteOnce"
  resources:
    requests:
      storage: "8Gi"
Nó tự tạo ra 1 PV ở màu sám
Khoe tý

Nếu bạn muốn longhorn có create volume trên các node có Taint Toleration thì sem thêm bài bên dưới

[Longhorn] fix No schedule volumes in Taint Toleration Nodes
Kubernetes & Container, Longhorn - Storage

Post navigation

Previous Post: [Jenkins] Lesson 11: overrideIndexTriggers in Jenkins Pipeline
Next Post: [Jenkins] Lesson 12: skipStagesAfterUnstable with Jenkins Pipeline

More Related Articles

[Longhorn/Storage] Install Longhorn on Kubernetes through helm and config Taints and Tolerations Kubernetes & Container
[Istio/multi cluster] Install multi-cluster Istio with mode “Primary-Remote” for Kubernetes on Google Cloud Platform. Isito-EnvoyFilter
[HPA/Kubernetes] Scale Up As Usual, Scale Down Very Gradually – behavior in HPA K8s Kubernetes
[Cosign/Kyverno]Signing And Verifying Container Images With Sigstore Cosign And Kyverno Kubernetes
[Kubernetes] Lesson5: k8s easy – Multi-container, Probes Kubernetes & Container
[Helm Chart] Tìm hiểu – (gạch giữa), _ (gạch dưới), dấu chấm “.” trong helm chart Helm Chart

Comments (2) on “[Longhorn] Store label with longhorn in order to create many storage classes and have many storage styles “SSD, HDD, fast, slow””

  1. Hoàn says:
    November 22, 2021 at 4:39 pm

    có cách nào để tách traffic replicate disk đi ra một card mạng riêng không nhỉ. chứ giờ nó đi theo pod thì dễ bị nghẽn quá.

    Reply
    1. nim says:
      November 22, 2021 at 6:41 pm

      Theo cá nhân mình thì quan miệm này có từ thời mà các anh hosting chạy ảo hoá. Đương nhiên nó sẽ vẫn đúng trong 1 số trường hợp đặc thù.
      Muốn làm được việc mà bạn nói thì sẽ cần tìm hiểu khá sâu về network của k8s và mình nghĩ là bạn sẽ có thể không chọn longhorn

      GIờ nhìn theo khía cạnh khác. Bạn đi trên đường có khi nào bạn thấy đường xe máy chật cứng và đường ô tô thì rộng thêng thang chưa?
      Thay vì bạn làm cho hệ thống k8s trở nên quá phức tạm và vẫn muốn sài longhorn để pv và pvc cho nó đơn giản
      Bạn mua con 1 server 4 port 10Gigabit xong bạn Bonding lại. Thì bw lí tưởng 40Gigabit, hotswap network card,…
      Rồi bạn có hệ thống monitor traffic và alert ngon lành thì mình nghĩ đó không còn là vấn đề

      Reply

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

  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025
  • [tracetcp] How to perform a tracert command using a specific port. April 3, 2025

Archives

  • 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.