搭建 Istio 源码调试环境

1. 前置条件

  • 安装 docker,必须配置 docker 代理,否则 build 失败。 参考
  • 下载 istio 源码。
  • 安装 godlv 工具。参考

2. 设置环境变量

1
2
3
4
5
6
7
8
# docker 地址
export HUB="docker.io/youwillsee"

# istio 的源码目录
export ISTIO=/root/code/istio

# docker 的 tag
export TAG=1.17-debug

3. build istio

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 构建 debug 的版本,会输出在 out 目录下
make DEBUG=1 build

# 构建 debug 的版本,推到本地的 docker 中
make DEBUG=1 docker

# 推送到远端的 docker 中
make docker.push

# 清理
make clean

参考

设置 Docker 代理

1. 配置 docker 代理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 创建配置目录
mkdir -p /etc/systemd/system/docker.service.d

# 创建配置文件
vim /etc/systemd/system/docker.service.d/http-proxy.conf

# 配置文件内容
[Service]
Environment="HTTP_PROXY=http://ooooo:10800"
Environment="HTTPS_PROXY=http://ooooo:10800"

# 重启 docker
systemctl daemon-reload && systemctl restart docker

# 查看配置是否生效
systemctl show --property=Environment docker