通过Kubernetes运行IPFS集群

通过Kubernetes运行IPFS集群

kubernetes-ipfs是一个基于Kubernetes集群系统运行IPFS服务的项目,可以在Kubernetes管理界面进行规模的快速伸缩,可以通过Prometheus/Grafana动态监控运行情况。

  • 注意,运行IPFS集群需要消耗大量带宽和计算资源。

1、快速开始

kubernetes-ipfs 可以在全功能的kubernetes部署上运行,也可以在 minikube 上运行。

与Minikube工作

./reset-minikube.sh 设置 minikube到初始状态。

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

运行测试

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

go application 返回 0 当满足期望结果时, 1 为失败。

2、度量收集: Prometheus/Grafana

下面的步骤说明如何访问在本地机器上的Grafana web UI。

运行 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,而不需要其他的授权操作。

然后, 运行 init.sh之后, 你需要告诉Kubernetes 转发 local ports 到 Grafana interface的port。可以:

扫描二维码关注公众号,回复: 103342 查看本文章
  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

 

3、示例

Simple Add > Cat test with 2 nodes

Simple Add > Pin test with 5 nodes

 

4、编写测试用例

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.

猜你喜欢

转载自my.oschina.net/u/2306127/blog/1621664
今日推荐