Skip to content

Commit

Permalink
add docs for K8S_WATCH_POLICY (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharang authored Sep 24, 2024
1 parent 9ac118b commit 6b290ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions docs/zh/02-ce-install/08-serverless-pod.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,26 @@ end

# 部署 deepflow-agent

更改 value 文件,以 daemonset 部署 deepflow-agent 并注入 sidecar,并通过`deepflow-ctl domain list`获取`clusterNAME`
更改 value 文件,以 daemonset 部署 deepflow-agent 并注入 sidecar,并通过 `deepflow-ctl domain list` 获取 `clusterNAME`

```bash
cat << EOF > values-custom.yaml
deployComponent:
- "daemonset"
- "watcher"
- "daemonset"
tke_sidecar: true
clusterNAME: $clusterNAME # FIXME: domain name
EOF

helm install deepflow-agent -n deepflow deepflow/deepflow-agent --version 6.5.012 --create-namespace -f values-custom.yaml
```

如果不希望 sidecar 形式的 deepflow-agent 承担 list-watch apiserver 的角色,建议部署一个单独的 deepflow-agent deployment 来同步 K8s 资源,具体方法可参考[部署 deployment 模式 DeepFlow Agent](../best-practice/special-environment-deployment/#部署-deployment-模式-deepflow-agent)
上述命令将会部署两组 deepflow-agent:
- watcher:一个 deepflow-agent 的 deployment,用于同步 K8s 资源。
- 部署时会自动注入 `K8S_WATCH_POLICY=watch-only` 的环境变量,此时 deepflow-agent 仅会同步 K8s 资源,不会采集可观测性数据。
- daemonset:在每个 serverless pod 中以 sidecar 的方式注入 deepflow-agent,用于采集可观测性数据。
- 注意:当没有运行 watcher 类型的 deepflow-agent 时,deepflow-server 会选举一个 daemonset 类型的 deepflow-agent 用于同步 K8s 资源。
- 因此,为了确保此类 deepflow-agent 不要因为被选举用于同步 K8s 资源而消耗更多资源,可以为他们额外注入 `K8S_WATCH_POLICY=watch-disabled` 的环境变量。

# 下一步

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/04-best-practice/03-special-environment-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ ClusterRole 配置增加:
当没有在 Kubernetes 集群中运行 Daemonset 的权限、但可在 K8s Node 上直接运行普通进程时,可使用该方法实现 Agent 部署。

- 以 deployment 形态部署一个 deepflow-agent
- 通过设置环境变量 `ONLY_WATCH_K8S_RESOURCE`,该 agent 仅实现对 K8s 资源的 list-watch 及上送控制器的功能
- 通过设置环境变量 `K8S_WATCH_POLICY=watch-only`,该 agent 仅实现对 K8s 资源的 list-watch 及上送控制器的功能
- 这个 agent 的其他所有功能均会自动关闭
- agent 请求 server 时告知自己在 watch-k8s,server 会将此信息更新到 MySQL 数据库中
- 这个仅用做 Watcher 的 Agent 将不会出现在 Agent 列表中
Expand All @@ -250,7 +250,7 @@ helm install deepflow -n deepflow deepflow/deepflow-agent --create-namespace \
-f values-custom.yaml
```

部署后,将自动创建 Domain(对应此 K8s 集群),通过`deepflow-ctl domain list`中获取 `your-cluster-name` cluster 的 `kubernetes-cluster-id`,再继续下面的操作。
部署后,将自动创建 Domain(对应此 K8s 集群),通过 `deepflow-ctl domain list` 中获取 `your-cluster-name` cluster 的 `kubernetes-cluster-id`,再继续下面的操作。

### 部署普通进程形式的 DeepFlow Agent

Expand Down

0 comments on commit 6b290ae

Please sign in to comment.