经过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.
相关文章
相关标签/搜索