Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Longhorn知ってますか?ステーキじゃない方

Wenhan Shi
October 27, 2020
420

 Longhorn知ってますか?ステーキじゃない方

Wenhan Shi

October 27, 2020
Tweet

Transcript

  1. © Copyright 2020 Rancher Labs. All Rights Reserved. 1 ©

    Copyright 2020 Rancher Labs. All Rights Reserved. 1 Kubernetes Novice Tokyo #6 Longhorn知ってますか? ステーキじゃない方 2020/10/26 Wenhan Shi
  2. © Copyright 2020 Rancher Labs. All Rights Reserved. 2 ⾃⼰紹介

    • 施 ⽂翰 (シ ブンカン) Wenhan Shi • @shi_wenhan • [email protected] • 経歴 • ⽇⽴製作所 - Linux カーネルモジュールの保守サポート • Red Hat K.K. - GlusterFS/OpenShift サポート • Canonical Japan K.K. - Ubuntu/OpenStack/Kubernetes サポート • Rancher Lab Inc, - Support Engineer
  3. © Copyright 2020 Rancher Labs. All Rights Reserved. 3 Longhorn!

    • 横に伸びた⻑い⾓を持った家畜⽜、 ステーキとして⼤⼈気 • でも今⽇の主役はこっちじゃない https://en.wikipedia.org/wiki/Texas_Longhorn https://www.longhornsteakhouse.com/
  4. © Copyright 2020 Rancher Labs. All Rights Reserved. 4 Distributed

    Block Storage Software(SDS) for Kubernetes https://longhorn.io/ One click to add persistent storage support to any Kubernetes cluster
  5. © Copyright 2020 Rancher Labs. All Rights Reserved. 5 A

    CNCF sandbox project Longhorn! • メリットはこれだけじゃない • ローカルディスクを使ってPV/Volumeを動的プロビジョニング • データを複数コピーで⾼信頼 • 単独Web UIでPV/PVC/Diskを可視化 • AWS S3 / NFS バックアップ・リストア機能内蔵
  6. © Copyright 2020 Rancher Labs. All Rights Reserved. 6 アーキテクチャ

    • クラウドネイティブ設計 • ファイルシステム利⽤ • Ext4、xfs • 1 Volume : 1 Engine
  7. © Copyright 2020 Rancher Labs. All Rights Reserved. 8 https://longhorn.io/docs/1.0.2/deploy/install/install-with-kubectl/

    Install Longhorn from kubectl • LonghornのGitリポジトリのYAMLファイルを利用 $ kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml
  8. © Copyright 2020 Rancher Labs. All Rights Reserved. 9 https://longhorn.io/docs/1.0.2/deploy/install/install-with-helm/

    Install Longhorn from helm • LonghornのChartを利用 $ helm repo add longhorn https://charts.longhorn.io $ helm repo update # helm 2 $ helm install longhorn/longhorn --name longhorn --namespace longhorn-system # helm 3 $ kubectl create namespace longhorn-system $ helm install longhorn longhorn/longhorn --namespace longhorn-system
  9. © Copyright 2020 Rancher Labs. All Rights Reserved. 10 Confirm

    Longhorn installation インストール後の確認 $ kubectl -n longhorn-system get pod NAME READY STATUS RESTARTS AGE csi-attacher-6fdc77c485-8wlpg 1/1 Running 0 9d csi-attacher-6fdc77c485-psqlr 1/1 Running 0 9d csi-attacher-6fdc77c485-wkn69 1/1 Running 0 9d csi-provisioner-78f7db7d6d-rj9pr 1/1 Running 0 9d csi-provisioner-78f7db7d6d-sgm6w 1/1 Running 0 9d csi-provisioner-78f7db7d6d-vnjww 1/1 Running 0 9d engine-image-ei-6e2b0e32-2p9nk 1/1 Running 0 9d engine-image-ei-6e2b0e32-s8ggt 1/1 Running 0 9d engine-image-ei-6e2b0e32-wgkj5 1/1 Running 0 9d longhorn-csi-plugin-g8r4b 2/2 Running 0 9d longhorn-csi-plugin-kbxrl 2/2 Running 0 9d longhorn-csi-plugin-wv6sb 2/2 Running 0 9d longhorn-driver-deployer-788984b49c-zzk7b 1/1 Running 0 9d longhorn-manager-nr5rs 1/1 Running 0 9d longhorn-manager-rd4k5 1/1 Running 0 9d longhorn-manager-snb9t 1/1 Running 0 9d longhorn-ui-67b9b6887f-n7x9q 1/1 Running 0 9d
  10. © Copyright 2020 Rancher Labs. All Rights Reserved. 11 •

    PodでPVCからのVolumeをMount • Longhorn StorageClass からPVC作成 Try Longhorn StorageClass apiVersion: v1 kind: PersistentVolumeClaim metadata: name: longhorn-volv-pvc spec: accessModes: - ReadWriteOnce storageClassName: longhorn resources: requests: storage: 2Gi apiVersion: v1 kind: Pod metadata: name: volume-test namespace: default spec: containers: - name: volume-test image: nginx:stable-alpine imagePullPolicy: IfNotPresent volumeMounts: - name: volv mountPath: /data ports: - containerPort: 80 volumes: - name: volv persistentVolumeClaim: claimName: longhorn-volv-pvc
  11. © Copyright 2020 Rancher Labs. All Rights Reserved. 12 Longhorn

    UIのデプロイ • Rancher カタログからインストールした場合は不要 • Ingressを作って、外部からのアクセスをLonghorn UI podに誘導 • 設定方法 https://longhorn.io/docs/1.0.2/deploy/accessing-the-ui/longhorn-ingress/ • 設定後、longhorn-frontendのsvcのアドレスからアクセス kubectl -n longhorn-system get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE longhorn-backend ClusterIP 10.20.248.250 <none> 9500/TCP 58m longhorn-frontend ClusterIP 10.20.245.110 <none> 80/TCP 58m
  12. © Copyright 2020 Rancher Labs. All Rights Reserved. 14 Longhorn

    Web UI • Volumeの各コピーのStatusが確認できる • データは各ノードの /var/lib/longhorn に保存
  13. © Copyright 2020 Rancher Labs. All Rights Reserved. 15 Kubernetes

    Cluster Region A バックアップ&リストア Pod A Standby DR Volume passively replicates from incremental snapshots being sent to a backup store S3 / NFS backup Store Multi-Cluster, Multi-site Disaster Recovery Kubernetes Cluster Region B Pod A Scheduled backups continually send deltas of volume to external cold storage In the event of failover, user syncs with the latest backup and becomes active for workloads in the cluster. Time to recovery is short because most of the delta is already replicated
  14. © Copyright 2020 Rancher Labs. All Rights Reserved. 16 Information

    • Homepage • https://longhorn.io/ • Documentation • https://longhorn.io/docs/1.0.2/ • Roadmap • https://github.com/longhorn/longhorn/wiki/Roadmap • Development updates • https://github.com/longhorn/longhorn/milestones/