Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
- Loading branch information
1 parent
3410987
commit f93b14a
Showing
9 changed files
with
135 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Istio 运维手册 | ||
# Istio 运维实战 | ||
|
||
[在线阅读](https://istio-operation-bible.aeraki.net/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
+++ | ||
title = "Istio 运维实战" | ||
linkTitle = "Istio 运维实战" | ||
title = "Istio 运维实战 " | ||
linkTitle = "Istio 运维实战 " | ||
|
||
+++ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: "Envoy 日志调试指南" | ||
title: "Envoy 日志分析" | ||
linkTitle: "" | ||
weight: 1 | ||
date: 2022-07-06 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: "Istio 调试端口" | ||
linkTitle: "" | ||
weight: 1 | ||
date: 2022-10-11 | ||
description: | ||
--- | ||
|
||
|
||
## Istio 调试接口 | ||
|
||
Istio 提供了一个调试端口 15014,通过该端口可以查看到 istiod 内部的大量调试信息,包括 istiod 的内存、cpu 使用情况,xds 缓存信息,连接到 istio 的代理,cluster 和 endpoint 信息等等。 | ||
|
||
可以通过下面的命令将 15014 端口 port forward 到 localhost: | ||
|
||
```bash | ||
k -n istio-system port-forward svc/istiod 15014 | ||
``` | ||
|
||
通过浏览器访问 ```http://127.0.0.1:15014/debug```, 可以看到调试端口支持获取的所有信息。 | ||
|
||
![istio-debug](image/istio-debug.png) | ||
|
||
## 查看 istiod 内存占用 | ||
|
||
将 istio 调试端口 port forward 到 localhost 后,可以采用下面的命令分析 istiod 的内存使用情况: | ||
|
||
```bash | ||
go tool pprof -http=:8080 localhost:15014/debug/pprof/heap | ||
``` | ||
|
||
该命令以 istio 调试端口输出的 heap 信息为输入,在 8080 端口上提供了 istiod 内存的详细分析。 | ||
|
||
![istio-heap](image/istio-heap.png) | ||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Istio 小技巧" | ||
linkTitle: "Istio 小技巧" | ||
weight: 90 | ||
description: > | ||
一些 Istio 小技巧 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
title: "directResoponse" | ||
weight: 1 | ||
date: 2022-10-17 | ||
description: > | ||
代理对符合某个条件的 HTTP 请求直接返回一个响应。 | ||
--- | ||
|
||
有时候我们希望 gateway/sidecar 能直接向客户端返回一个 HTTP response,而不用交给应用程序处理。 | ||
|
||
## 1.15 版本之前 | ||
|
||
可以通过 EnvoyFilter 来修改 HTTP Route,为匹配某个条件的 HTTP 请求直接返回指定的内容。例如,下面的 EnvoyFilter 为 ingress gateway 收到的 http://*:80/direct 直接返回一个 200 response,消息体为 ```hello world```。: | ||
|
||
```yaml | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: EnvoyFilter | ||
metadata: | ||
name: direct | ||
spec: | ||
workloadSelector: | ||
labels: | ||
istio: ingressgateway | ||
configPatches: | ||
- applyTo: HTTP_ROUTE | ||
match: | ||
context: GATEWAY | ||
routeConfiguration: | ||
portNumber: 80 | ||
patch: | ||
operation: INSERT_FIRST | ||
value: | ||
name: direct | ||
match: | ||
path: /direct | ||
directResponse: | ||
body: | ||
inlineString: 'hello world' | ||
status: 200 | ||
``` | ||
|
||
## 1.15 及之后版本 | ||
|
||
1.15 版本开始,VS 支持设置 directResponse,如下所示: | ||
|
||
```yaml | ||
apiVersion: networking.istio.io/v1alpha3 | ||
kind: VirtualService | ||
metadata: | ||
name: ratings-route | ||
spec: | ||
hosts: | ||
- ratings.prod.svc.cluster.local | ||
http: | ||
- match: | ||
- uri: | ||
exact: /v1/getProductRatings | ||
directResponse: | ||
status: 503 | ||
body: | ||
string: "unknown error" | ||
... | ||
``` | ||
|
||
## 参考文档 | ||
|
||
* EnvoyFilter https://istio.io/latest/docs/reference/config/networking/envoy-filter/ | ||
* HTTPDirectResponse https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPDirectResponse |