經過Kubernetes運行IPFS集羣

經過Kubernetes運行IPFS集羣

kubernetes-ipfs是一個基於Kubernetes集羣系統運行IPFS服務的項目,能夠在Kubernetes管理界面進行規模的快速伸縮,能夠經過Prometheus/Grafana動態監控運行狀況。node

  • 注意,運行IPFS集羣須要消耗大量帶寬和計算資源。

一、快速開始

kubernetes-ipfs 能夠在全功能的kubernetes部署上運行,也能夠在 minikube 上運行。git

與Minikube工做

./reset-minikube.sh 設置 minikube到初始狀態。github

./init.sh 在minikube上建立 go-ipfs 和 grafana deployments。web

運行測試

go run main.go tests/simple-add-and-cat.yml瀏覽器

go application 返回 0 當知足指望結果時, 1 爲失敗。app

 

二、度量收集: Prometheus/Grafana

下面的步驟說明如何訪問在本地機器上的Grafana web UI。ide

運行 init.sh 腳本以前, 確保 grafana-core deployment 在 prometheus-manifests.yml 中,已經有下面的變量設置:測試

- name: GF_AUTH_BASIC_ENABLED
  value: "false"
- name: GF_AUTH_ANONYMOUS_ENABLED
  value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
  value: Admin

這容許你訪問Grafana interface,而不須要其餘的受權操做。ui

而後, 運行 init.sh以後, 你須要告訴Kubernetes 轉發 local ports 到 Grafana interface的port。能夠:this

  1. 獲得包含 grafana-core deployment的pod。命令以下:

    $ kubectl get pods --namespace=monitoring | grep grafana-core | awk '{print $1}'
    grafana-core-2701824778-j52cq
  2. 告訴 kubectl 轉發全部本地 local port 3000 到port 3000,這是在上面操做發現的 grafana-core pod。這裏 3000 是grafana的內部端口,以下:

    kubectl port-forward --namespace=monitoring grafana-core-2701824778-j52cq 3000:3000

到這裏, 你已經能夠訪問 Grafana's web UI,在瀏覽器輸入 localhost:3000

 

三、示例

Simple Add > Cat test with 2 nodes

Simple Add > Pin test with 5 nodes

 

四、編寫測試用例

The tests are specified in a .yml file for each test.

Header

  • name: Name the test
  • nodes: How many nodes to run for the test. Kubernetes-ipfs will automatically scale the deployment to match the value here before starting
  • times: How many times to run the full test.
  • expected: define the number of expected outcomes. This value should be outcomes per test * times. Specify the expected successes, failures, and timeouts.

Steps

Each step contains a few flags that specify how they will be run, and a cmd which is the command to run on the node

  • name: Name the step
  • on_node: On which node number should we run this test?
  • end_node: When specified, we will run this test in parallel from on_node to end_node inclusive. Useful for testing simultaneous group interactions.
  • selection: An alternate way to choose the nodes that run a command. Allows for specifying ranges, percents and consistent subsets succinctly
  • for: An optional way to specify that a step be ran more than once. Can specify an iteration bound or a for each style iteration over an input array
  • outputs: Specify a line number of output and what environment variable to save it to. It can be used for the following input section
  • inputs: Specify the environment variables to take in for this command.
  • cmd: Verbatim command to run on the node. Bash variables will be evaluated.
  • timeout: At this many seconds, the step will be cancelled and counted as "timeout".
  • assertions: At the moment, only should_be_equal_to Specify that a line number of stdout should be equal to a line you have used save_to on. On success, adds a success count, on fail, adds a failure count.
相關文章
相關標籤/搜索