Skip to content

Commit

Permalink
Merge pull request #616 from Catherine-monk/advanced/debug
Browse files Browse the repository at this point in the history
update the zh of debug.md
  • Loading branch information
kubeedge-bot authored Sep 19, 2024
2 parents 86d3a2c + ce3a088 commit 939e798
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
7 changes: 4 additions & 3 deletions docs/advanced/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ sidebar_position: 3

## Update Configurations

1. Update `cloudcore` configuration to enable **cloudStream**.
1. Update `cloudcore` configuration to enable **cloudStream**. (The new version has this feature enabled by default in the cloud, so this configuration can be skipped.)

If `cloudcore` is installed as binary, you can directly modify `/etc/kubeedge/config/cloudcore.yaml` with using editor.
If `cloudcore` is running as kubernetes deployment, you can use `kubectl edit cm -n kubeedge cloudcore` to update `cloudcore`'s ConfigurationMap.
Expand All @@ -83,7 +83,7 @@ sidebar_position: 3
2. Update `edgecore` configuration to enable **edgeStream**.
This modification needs to be done all edge system where `edgecore` runs to update `/etc/kubeedge/config/cloudcore.yaml`.
This modification needs to be done all edge system where `edgecore` runs to update `/etc/kubeedge/config/edgecore.yaml`.
Make sure the `server` IP address to the cloudcore IP (the same as $CLOUDCOREIPS).
```yaml
Expand All @@ -102,7 +102,8 @@ sidebar_position: 3
1. Restart all the cloudcore and edgecore to apply the **Stream** configuration.
If `cloudcore` is installed as binary:
If `cloudcore` is installed as binary (If the `cloudcore.yaml` has not been updated, there is no need to restart.)
:
```shell
sudo systemctl restart cloudcore.service
```
Expand Down
56 changes: 28 additions & 28 deletions i18n/zh/docusaurus-plugin-content-docs/current/advanced/debug.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,70 @@
---
title: 启用Kubectl logs/exec/attach等能力
title: 启用 Kubectl logs/exec/attach 操作边缘 pods
sidebar_position: 3
---

## Prepare certs
## 准备证书

1. Make sure you can find the kubernetes `ca.crt` and `ca.key` files. If you set up your kubernetes cluster by `kubeadm` , those files will be in `/etc/kubernetes/pki/` dir.
1. 请确保可以找到 `ca.crt` `ca.key` 两个 Kubernetes 证书文件。 如果您使用 `kubeadm`进行 Kubernetes 集群安装,这两个文件将位于 `/etc/kubernetes/pki/` 路径下。

``` shell
ls /etc/kubernetes/pki/
```

2. Set `CLOUDCOREIPS` env. The environment variable is set to specify the IP address of cloudcore, or a VIP if you have a highly available cluster.
2. 设置 `CLOUDCOREIPS` 变量。 这个环境变量设置为指定 cloudcore 的 IP 地址,如果您的集群是以高可用方式部署,请设置为分配给负载均衡器的虚拟 IP 地址。

```bash
export CLOUDCOREIPS="192.168.0.139"
```
(Warning: the same **terminal** is essential to continue the work, or it is necessary to type this command again.) Checking the environment variable with the following command:
(注: 必须使用同一 **终端** 才能使设置生效, 如果更换了终端,必须再次执行该指令。)可以通过使用以下命令检查该环境变量:
``` shell
echo $CLOUDCOREIPS
```

3. Generate the certificates for **CloudStream** on cloud node, however, the generation file is not in the `/etc/kubeedge/`, we need to copy it from the repository which was git cloned from GitHub.
Change user to root:
3. 接下来,需要给云节点上为 **CloudStream** 生成证书,然而,相关生成脚本不在 `/etc/kubeedge/` 中, 我们需要从 GitHub 的 git 仓库中获取。
改变权限至 root 权限:
```shell
sudo su
```
Copy certificates generation file from original cloned repository:
从 git 仓库中 clone 证书生成文件:
```shell
cp $GOPATH/src/github.com/kubeedge/kubeedge/build/tools/certgen.sh /etc/kubeedge/
```
Change directory to the kubeedge directory:
切换到 kubeedge 路径下:
```shell
cd /etc/kubeedge/
```
Generate certificates from **certgen.sh**
使用 **certgen.sh** 生成证书:
```bash
/etc/kubeedge/certgen.sh stream
```

## Set Iptables Rule
## 设置 Iptables 规则

1. Set iptables on the host. This command should be executed on every node which deployed apiserver.(In this case, it is the master node, and execute this command by root.)
1. 在主机上设置iptables。注意这个命令需要在部署了 apiserver 的每个节点上执行。(在本例中,是在主节点,运用通过 root 用户执行命令。)

Run the following command on the host on which each apiserver runs:
在每个运行有 apiserver 的主机上运行以下命令:

**Note:** You need to set the cloudcoreips variable first
**:** 请先确保 CLOUDCOREIPS 环境变量设置正确

```bash
iptables -t nat -A OUTPUT -p tcp --dport 10350 -j DNAT --to $CLOUDCOREIPS:10003
```
> Port 10003 and 10350 are the default ports for the CloudStream and edgecore,
use your own ports if you have changed them.
> 端口 10003 和 10350 是 CloudStream 和 edgecore 的默认端口,如果您对它们做过修改,请使用您设置的端口。

If you are not sure whether you have a setting of iptables, and you want to clean all of them.
(If you set up iptables wrongly, it will block you out of this feature)
如果您不确定是够有 iptables 设置,并且想清理所有 iptables 规则。
(如果您设置了错误的 iptables,它会阻止您使用此功能)

The following command can be used to clean up iptables:
以下命令用于清除 iptables 规则:
``` shell
iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X
```

## Update Configurations
## 更新配置

1. Modify **both** `/etc/kubeedge/config/cloudcore.yaml` and `/etc/kubeedge/config/edgecore.yaml` on cloudcore and edgecore. Set up **cloudStream** and **edgeStream** to `enable: true`. Change the server IP to the cloudcore IP (the same as $CLOUDCOREIPS).
1. 更新 cloudcore 的配置使 CloudStream 生效 (新版本云端已默认开启,可跳过本配置)
如果 cloudcore 是以二进制方式安装的,您可以直接使用编辑器修改 /etc/kubeedge/config/cloudcore.yaml。如果 cloudcore是以容器方式运行,您可以直接使用 kubectl edit cm -n kubeedge cloudcore 来更新 cloudcore 的 ConfigMap。

Modify `/etc/kubeedge/config/cloudcore.yaml`:
```yaml
cloudStream:
enable: true
Expand All @@ -78,8 +77,8 @@ sidebar_position: 3
tlsTunnelPrivateKeyFile: /etc/kubeedge/certs/server.key
tunnelPort: 10004
```

Modify `/etc/kubeedge/config/edgecore.yaml`:
1. 更新 edgecore 的配置使 EdgeStream 生效。
此修改需要在 edgecore 运行所在的边缘节点上进行,更新 /etc/kubeedge/config/edgecore.yaml,确保 server IP 地址为 cloudcore IP (与 $CLOUDCOREIPS 相同)。
``` yaml
edgeStream:
enable: true
Expand All @@ -92,16 +91,17 @@ sidebar_position: 3
writeDeadline: 15
```

## Restart
## 重启

1. Restart all the cloudcore and edgecore.
1. 重启 cloudcore edgecore 让配置生效。

At the cloud side:
在云端(若 cloudcore.yaml 未更新,则无需重启):
``` shell
sudo systemctl restart cloudcore.service
```

At the edge side:
在边缘端:
``` shell
sudo systemctl restart edgecore.service
```

0 comments on commit 939e798

Please sign in to comment.