节点服务器的结构与功能
-
主服务器:
- 负责管理服务,执行所有服务请求。
- 使用Nginx作为核心服务器,负责日志、请求处理和流量统计。
-
从节点:
- 计算请求,执行命令行操作。
- 通过Nginx和Kubernetes管理从节点之间的交互。
-
Nginx:
- 运行Nginx,管理服务、日志、请求处理和流量统计。
- 适合节点的日常运行和配置。
-
Kubernetes:
使用Kubernetes管理节点,执行任务、监控服务和配置服务。
-
Nagfile:
使用Nagfile作为节点配置文件,包含服务定义、规则和日志配置。
核心配置步骤
-
启动节点:
使用curl命令启动节点,启动Nginx、Kubernetes、Nagfile和ngrok服务。
-
启动Nginx:
- 使用
ngrok命令启动Nginx。
- 使用
-
启动Kubernetes:
- 使用
kubernetes命令启动Kubernetes服务。
- 使用
-
启动Nagfile:
- 使用
ngrok命令启动ngrok服务。
- 使用
-
启动ngrok容器:
- 使用
ngrok命令启动ngrok容器。
- 使用
配置规则
-
规则类型:
- 静态规则:定义在启动节点前。
- 动态规则:在运行时自动定义。
- 动态变化规则:在运行时动态定义。
-
:
包括文件、URL、列表、迭代器、查询器、聚合器等。
-
规则参数:
包括文件路径、层级、规则名称、类型、内容、参数等。
运行步骤
-
启动节点:
双击启动节点,启动Nginx、Kubernetes、Nagfile和ngrok服务。
-
启动Nginx:
ngrok命令启动Nginx。
-
启动Kubernetes:
kubernetes命令启动Kubernetes服务。
-
启动Nagfile:
ngrok命令启动ngrok服务。
-
启动ngrok容器:
ngrok命令启动ngrok容器。
查看服务器状态
- 使用
curl命令:curl -X POST -H "Content-Type: application/json" -H "Content-Type: text/event-stream" -d '{"name":"test"}' https://localhost:3- 查看服务器状态。
使用ngrok访问网站
-
加载ngrok服务:
curl -v -X POST https://localhost:3 -H "Content-Type: application/json" -d '{"name":"ngrok"}'
-
访问ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用Kubernetes命令
-
运行Kubernetes:
kubernetes run --template=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
获取服务信息:
kubernetes info --namespace=kubernetes
-
查看服务状态:
kubernetes status --namespace=kubernetes
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok服务:
ngrok serve
-
查看ngrok服务:
curl -v -X POST https://localhost:3 -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
curl -v -X POST https://localhost:3/containers -H "Content-Type: application/json" -d '{"name":"ngrok"}'
使用ngrok容器
-
启动ngrok容器:
ngrok -s --container=kubernetes/containers/default.k8s --env-file=kubernetes/containers/containers.k8s.xml
-
运行ngrok容器:
ngrok serve
-
查看ngrok容器:
`curl -









