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
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • 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, 2021January 4, 2022 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

[Kubernetes] Lesson3: k8s easy – Label and selector in Kubernetes Kubernetes & Container
[Minio] Install MinIO on Kubernetes through minio-operator Kubernetes & Container
[AWS] Creating EKS windows on AWS and Running windows pods AWS - Amazon Web Service
[K8s] Hướng dẫn sử dụng kubectl trên mấy local kết nối đến k8s master Kubernetes
[ArgoCD] Cài đặt argocd cli và connect với ArgoCD ArgoCD
[Vault/Consul] Install vault and consul through Helm in K8s Kubernetes & Container

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

  • [AWS] Look into Data Transfer on AWS May 30, 2023
  • [Ddosify] How to test the application performance with Ddosify. May 30, 2023
  • [DevSecOps/TruffleHog] Find your repository’s secrets, sensitive words, and credentials. May 29, 2023
  • [DevSecOps] Tìm hiểu về thu thập thông tin. May 25, 2023
  • [coralogix/OpenTelemetry] Monitor Your K8s by Coralogix and OpenTelemetry Collector. May 24, 2023

Archives

  • 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
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.