ASM提供了对Istio配置状态的详细分析,以便标识无效或次优的配置。本文介绍此分析可能产生的Istio资源配置相关的错误或警告消息的详细说明。
IST0002: 特性废弃
消息名称 | 消息代码 | 等级 | 描述 |
Deprecated | IST0002 | Warning | 配置所依赖的功能现已弃用。 |
当您使用了计划在后续版本中移除的某些功能时,会出现此消息。
IST0106: 配置定义错误
消息名称 | 消息代码 | 等级 | 描述 |
SchemaValidationError | IST0106 | Error | 该资源存在结构验证错误。 |
当您的资源配置没有成功通过结构验证时,会出现此消息。
异常示例
以下是一个有错误的VirtualService资源配置。
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: ratings-bogus-weight-default
namespace: default
spec:
hosts:
- ratings
http:
- route:
- destination:
host: ratings
subset: v1
weight: 999
- destination:
host: ratings
subset: v2
weight: 888
在实际创建资源时,您会收到以下错误。
Error [IST0106] (VirtualService ratings-bogus-weight-default.default) Schema validation error: percentage 888 is not in range 0..100
Error [IST0106] (VirtualService ratings-bogus-weight-default.default) Schema validation error: percentage 999 is not in range 0..100
出现此错误的原因是在进行结构检查时,发现weight
属性的取值错误或无效。您可以根据错误信息中的描述对资源进行更正并重试。
IST0112: 虚拟服务需要设置目标端口
消息名称 | 消息代码 | 等级 | 描述 |
VirtualServiceDestinationPortSelectorRequired | IST0112 | Error | 该虚拟服务(VirtualService)将流量路由到一个暴露了多个端口的服务,但未明确指定要使用哪个端口。 |
当 Virtual Service 连接到暴露了多个端口的 Service 但并未指定使用哪一个端口时会出现此消息。 这种情况会造成未定义的行为。
IST0128: 目标规则中未定义目标级别CA证书
消息名称 | 消息代码 | 等级 | 描述 |
NoServerCertificateVerificationDestinationLevel | IST0128 | Warning | 在DestinationRule中未设置CA证书,无法验证服务器证书的有效性。 |
如果流量策略需要 caCertificates
,但是在 DestinationRule 中没有相关信息,会出现此消息。
异常示例
当您的集群中包含以下 DestinationRule 时:
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
name: db-tls
spec:
host: mydbserver.prod.svc.cluster.local
trafficPolicy:
tls:
mode: SIMPLE
clientCertificate: /etc/certs/myclientcert.pem
privateKey: /etc/certs/client_private_key.pem
# caCertificates 未设置
您会收到此消息:
Error [IST0128] (DestinationRule db-tls.default) DestinationRule default/db-tls in namespace default has TLS mode set to SIMPLE but no caCertificates are set to validate server identity for host: mydbserver.prod.svc.cluster.local
错误原因是示例中DestinationRule 的 db-tls
被明确为 TLS,但是没有设置 CA 证书文件。
修复方式
提供 CA 证书的文件名
修改流量策略为不需要证书的类型
IST0129: 目标规则中未定义端口级别CA证书
消息名称 | 消息代码 | 等级 | 描述 |
NoServerCertificateVerificationPortLevel | IST0129 | Warning | 在DestinationRule中未设置CA证书caCertificates,这将导致到指定端口的流量无法验证服务器提供的证书。 |
当流量策略需要 caCertificates
,但DestinationRule中没有设置相关信息时,会出现此消息。
异常示例
当您的集群中具有以下 DestinationRule 时:
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
name: db-tls
spec:
host: mydbserver.prod.svc.cluster.local
trafficPolicy:
portLevelSettings:
- port:
number: 443
tls:
mode: SIMPLE
clientCertificate: /etc/certs/myclientcert.pem
privateKey: /etc/certs/client_private_key.pem
sni: my-nginx.mesh-external.svc.cluster.local
# caCertificates 未设置
您将会收到此消息:
Error [IST0129] (DestinationRule db-tls.default) DestinationRule default/db-tls in namespace default has TLS mode set to SIMPLE but no caCertificates are set to validate server identity for host: mydbserver.prod.svc.cluster.local at port number:4430
在此示例中,DestinationRule的db-tls
被指定为TLS,但是没有提供相关CA证书文件。
修复方式
提供 CA 证书的文件名
修改流量策略为不需要证书的类型
IST0130: 虚拟服务路由规则不可达
消息名称 | 消息代码 | 等级 | 描述 |
VirtualServiceUnreachableRule | IST0130 | Warning | 由于之前的规则已使用相同的匹配条件,因此该VirtualService规则永远不会被使用。 |
当VirtualService中存在因匹配条件与之前规则重复而无法生效的路由规则时,系统会触发此提示。此外,若多个路由规则之间因条件冲突或未定义有效匹配路径而无法生效,也会触发该提示。
异常示例
当您的集群中包含下列 Virtual Service 时:
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: sample-foo-cluster01
namespace: foo
spec:
hosts:
- sample.foo.svc.cluster.local
http:
- fault:
delay:
fixedDelay: 5s
percentage:
value: 100
route:
- destination:
host: sample.foo.svc.cluster.local
- mirror:
host: sample.bar.svc.cluster.local
route:
- destination:
host: sample.bar.svc.cluster.local
subset: v1
您将会收到以下消息:
Warning [IST0130] (VirtualService sample-foo-cluster01.default) VirtualService rule #1 not used (only the last rule can have no matches).
在这个示例中,VirtualService 同时指定了 fault 和 mirror。 允许同时使用,但是必须在同一个路由下。用户在此处使用了两个不同的 http 路由条目(每个 -
一个条目),第一个会覆盖第二个。
修复方式
当 HTTP 路由未指定 match
条件时,只能存在一个 HTTP 路由。在这种情况下,移除 mirror
前的 -
符号表示这是一个单个无匹配条件的路由,它同时执行“注入故障”和“流量镜像”操作,而非创建两个独立的路由(一个仅注入故障,另一个仅镜像流量)。
注意 YAML 格式在复杂路由配置中的重要性:
请重新调整路由顺序,确保最具体的路由规则(如精确匹配路径或头信息的规则)优先排列。
将“通配路由”(
catch all
,即匹配所有流量的默认路由)置于列表末尾。
IST0131: 无效的虚拟服务路由匹配规则
消息名称 | 消息代码 | 等级 | 描述 |
VirtualServiceIneffectiveMatch | IST0131 | Info | VirtualService路由规则的匹配条件与之前的规则存在重复。 |
当虚拟服务中存在因匹配条件与之前规则重复而无法生效的路由规则时,会触发此提示。
异常示例
当您的集群中包含下列 Virtual Service 时:
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: tls-routing
spec:
hosts:
- www1.googleapis.com
- api1.facebook.com
tls:
- match:
- port: 2443
sniHosts:
- www1.googleapis.com
route:
- destination:
host: www1.googleapis.com
- match:
- port: 2443
sniHosts:
- www1.googleapis.com
route:
- destination:
host: api1.facebook.com
您将会收到以下消息:
Info [IST0131] (VirtualService tls-routing.default) VirtualService rule #1 match #0 is not used (duplicates a match in rule #0).
在此示例中,虚拟服务为同一匹配条件配置了两个不同目标。Istio 仅采用第一个匹配规则,后续流量将不会路由到第二个目标。
修复方式
若需将流量分发至多个目标,请使用流量镜像功能(mirror
)。
请重新排序路由规则,使最具体的匹配条件(如特定路径或头信息)优先匹配,并将通用的“通配路由”(catch all
)置于列表末尾。
IST0133: 配置定义不规范
配置存在不规范的定义。
IST0134: ServiceEntry未定义服务地址
消息名称 | 消息代码 | 等级 | 描述 |
ServiceEntryAddressesRequired | IST0134 | Warning | 当代理未启用 |
当 ServiceEntry 的 protocol
字段未设置、设置为 TCP
或未定义 addresses
时,会出现此消息。
异常示例
当您的集群中包含下列ServiceEntry
时:
apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
name: service-entry
namespace: default
spec:
hosts:
- 'istio.io'
exportTo:
- "."
ports:
- number: 443
name: https
location: MESH_EXTERNAL
resolution: DNS
apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
name: service-entry
namespace: default
spec:
hosts:
- 'istio.io'
exportTo:
- "."
ports:
- number: 443
name: https
protocol: TCP
location: MESH_EXTERNAL
resolution: DNS
您将收到以下消息:
Warning [IST0134] (ServiceEntry service-entry.default serviceentry.yaml:13) ServiceEntry addresses are required for this protocol.
修复方式
请确保在 protocol
未设置或设置为 TCP 时,在 ServiceEntry 中设置 addresses
。 如果未设置 addresses
,则将匹配 ServiceEntry 所定义的端口上的所有流量,与主机无关。
IST0140: 入口网关规则路由规则子集未定义
当前在网关生效的虚拟服务中存在未定义域名路由规则的子集,但在网格中存在虚拟服务定义了相同域名的路由规则子集。
IST0151: EnvoyFilter使用了相对位置操作
消息名称 | 消息代码 | 等级 | 描述 |
EnvoyFilterUsesRelativeOperation | IST0151 | Warning | 此 |
当 EnvoyFilter
没有优先级且使用相对补丁操作(INVALID
、MERGE
、REMOVE
、INSERT_BEFORE
、INSERT_AFTER
、REPLACE
)时, 会出现此消息。使用相对补丁操作意味着当评估当前的 EnvoyFilter
过滤器时该操作依赖于另一个过滤器。 为了确保按照用户想要的顺序应用 EnvoyFilters
,应该赋予一个优先级或者应该使用一个非相对操作(ADD
或 INSERT_FIRST
)。
异常示例
以一个带有 INSERT_BEFORE
补丁操作的 EnvoyFilter
为例:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-relative
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews2
configPatches:
# 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
portNumber: 8080
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: INSERT_BEFORE
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
5000)
end
修复方式
由于原来使用了 INSERT_BEFORE
的相对操作,所以现在将其更改为 INSERT_FIRST
的绝对操作将解决这个问题:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-relative
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews2
configPatches:
# 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
portNumber: 8080
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: INSERT_FIRST
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
5000)
end
IST0152: EnvoyFilter REPLACE操作无效
消息名称 | 消息代码 | 等级 | 描述 |
EnvoyFilterUsesReplaceOperationIncorrectly | IST0152 | Error |
|
当 EnvoyFilter
使用 REPLACE
操作并且 ApplyTo
设置为 HTTP_FILTER
或 NETWORK_FILTER
时, 会出现此消息。这将导致 REPLACE
操作被忽略,因为 HTTP_FILTER
和 NETWORK_FILTER
对于 REPLACE
无效。
异常示例
以一个带有 REPLACE
补丁操作的 EnvoyFilter
为例,这个 EnvoyFilter
将被忽略:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-replace-2
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews2
priority: 10
configPatches:
# 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器
- applyTo: HTTP_FILTER
match:
context: SIDECAR_INBOUND
listener:
portNumber: 8080
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: REPLACE
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
5000)
end
IST0153: EnvoyFilter ADD操作无效
消息名称 | 消息代码 | 等级 | 描述 |
EnvoyFilterUsesAddOperationIncorrectly | IST0153 | Error | 当 |
当 在EnvoyFilter
中使用 ADD
操作且 ApplyTo
设置为 ROUTE_CONFIGURATION
或 HTTP_ROUTE
时,会出现此消息。 这将导致 ADD
操作被忽略。目前,只有 MERGE
操作可用于 ROUTE_CONFIGURATION
。
异常示例
如果一个 EnvoyFilter
附带有 ADD
补丁操作,该 EnvoyFilter
将被忽略:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-auth-2
namespace: bookinfo
spec:
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: SIDECAR_INBOUND
patch:
operation: ADD
filterClass: AUTHZ # 此过滤器将在 Istio 的 authz 过滤器之后运行。
value:
name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
grpc_service:
envoy_grpc:
cluster_name: acme-ext-authz
initial_metadata:
- key: foo
value: myauth.acme # required by local ext auth server.
IST0154: EnvoyFilter REMOVE操作无效
消息名称 | 消息代码 | 等级 | 描述 |
EnvoyFilterUsesRemoveOperationIncorrectly | IST0154 | Error | 当 EnvoyFilter 的 |
当 EnvoyFilter
使用 REMOVE
操作并且 ApplyTo
设置为 ROUTE_CONFIGURATION
或 HTTP_ROUTE
时会出现此消息。这将导致 REMOVE
操作被忽略。 目前只有 MERGE
操作可以用于 ROUTE_CONFIGURATION
。
异常示例
创建了带有 REMOVE
补丁操作的 EnvoyFilter
,这个 EnvoyFilter
将被忽略:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-remove-2
namespace: bookinfo
spec:
workloadSelector:
labels:
app: mysvc2
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: GATEWAY
listener:
filterChain:
sni: app.example.com
filter:
name: "envoy.filters.network.http_connection_manager.InternalAddressConfig"
patch:
operation: REMOVE
IST0155: EnvoyFilter未设置优先级
消息名称 | 消息代码 | 等级 | 描述 |
EnvoyFilterUsesRelativeOperationWithProxyVersion | IST0155 | Warning | 此 |
当 EnvoyFilter
没有设置优先级并没有使用相关补丁操作 (INSERT_BEFORE/AFTER
、REPLACE
、MERGE
、DELETE
) 和 proxyVersion
时会出现此消息,这可能会导致 EnvoyFilter
升级期间没有被应用。使用 INSERT_FIRST
或 ADD
选项或设置优先级可能有助于确保 EnvoyFilter
被正确应用。 关注 proxyVersion
的原因是,在升级后,proxyVersion
可能会发生变化, 升级后它的使用顺序可能不同于升级前的顺序。
异常示例
一个 EnvoyFilter
使用了补丁操作 REPLACE
,并配置了proxyVersion
:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-replace-3
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews4
configPatches:
# 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
proxy:
proxyVersion: '^1\.11.*'
listener:
portNumber: 8080
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: REPLACE
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
1000)
end
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-replace-4
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews4
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
patch:
operation: REPLACE
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
5000)
end
修复方式
由于 REPLACE
的相关操作是与 proxyVersion
一起使用, 所以可以添加 priority
来解决这个问题:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-replace-3
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews4
priority: 10
configPatches:
# 第一个补丁将 Lua 过滤器添加到 listener/http 连接管理器
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
proxy:
proxyVersion: '^1\.11.*'
listener:
portNumber: 8080
filterChain:
filter:
name: "envoy.filters.network.http_connection_manager"
subFilter:
name: "envoy.filters.http.router"
patch:
operation: REPLACE
value: # Lua 过滤器规范
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
1000)
end
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: test-replace-4
namespace: bookinfo
spec:
workloadSelector:
labels:
app: reviews4
priority: 20
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
patch:
operation: REPLACE
value: #Lua filter specification
name: envoy.lua
typed_config:
"@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
inlineCode: |
function envoy_on_request(request_handle)
-- Make an HTTP call to an upstream host with the following headers, body, and timeout.
local headers, body = request_handle:httpCall(
"lua_cluster",
{
[":method"] = "POST",
[":path"] = "/acl",
[":authority"] = "internal.org.net"
},
"authorize call",
5000)
end
IST0157: 无效的TelemetryProvider
消息名称 | 消息代码 | 等级 | 描述 |
InvalidTelemetryProvider | IST0157 | Warning | 如果 Telemetry 配置中 providers 为空,则该配置将被忽略。 |
当设置了具有空提供程序的 Telemetry 资源时,会出现此消息, 如果 MeshConfig 中的 defaultProviders
为空,则该消息将被忽略。
IST0161: 无效的网关规则证书
消息名称 | 消息代码 | 等级 | 描述 |
InvalidGatewayCredential | IST0161 | Error | 提供的 Gateway 资源凭证无效。 |
当 Gateway 资源引用具有 TLS 配置的 Secret, 且该 Secret 未包含或包含无效的 TLS 证书时, InvalidGatewayCredential
消息将出现。 此消息有助于识别 Gateway 资源的 TLS 配置问题, 这些问题可能会导致安全问题或无法正常连接等情况的发生。
满足以下条件时会生成此消息:
Gateway 资源有一个带有 TLS 配置的服务器。
TLS 配置引用了
credentialName
。未找到具有指定
credentialName
的 Secret, 或者在找到的 Secret 中发现无效 TLS 证书。
修复方式
请确保具有指定 credentialName
的 Secret 存在于与 Gateway 工作负载相同的命名空间中, 并且该 Secret 包含有效的 TLS 证书。 您可能需要创建或更新 Secret 才能解决此问题。
如果 Secret 丢失,请使用正确的 TLS 证书和私钥创建一个新的 Secret。 例如,通过使用 kubectl
:
kubectl create secret tls my-tls-secret --cert=path/to/cert.pem --key=path/to/key.pem -n <namespace>
确保将 <namespace>
替换为运行 Gateway 工作负载的实际命名空间, 并更新文件路径以指向正确的证书和密钥文件。
如果 Secret 存在但其中的 TLS 证书无效, 请使用正确的 TLS 证书和私钥来更新 Secret。
IST0163: 无效的外部控制面配置
消息名称 | 消息代码 | 等级 | 描述 |
InvalidExternalControlPlaneConfig | IST0163 | Warning | 为外部控制平面上的入口网关所配置的地址是无效的。 |
当为外部控制平面上的入口网关提供的地址无效时,会出现此消息。 该地址可能因多种原因而无效,包括:主机名地址格式错误、 主机名无法通过 DNS 查询解析为 IP 地址或者主机名解析出的 IP 地址数为零。
异常示例
当集群的
ValidatingWebhookConfiguration
和MutatingWebhookConfiguration
缺少 Webhook URL 时:apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: istio-validator-external-istiod webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: name: rev.validation.istio.io --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: istiod-default-validator webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com:15017/validate failurePolicy: Ignore name: validation.istio.io --- apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: istio-sidecar-injector-external-istiod webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: failurePolicy: Fail name: rev.namespace.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: rev.object.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: namespace.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: object.sidecar-injector.istio.io
您将收到此消息:
Warning [IST0163] (MutatingWebhookConfiguration istio-sidecar-injector-external-istiod testing.yml:28) The hostname () that was provided for the webhook (rev.namespace.sidecar-injector.istio.io) to reach the ingress gateway on the external control plane cluster is blank. Traffic may not flow properly. Warning [IST0163] (ValidatingWebhookConfiguration istio-validator-external-istiod testing.yml:1) The hostname () that was provided for the webhook (rev.validation.istio.io) to reach the ingress gateway on the external control plane cluster is blank. Traffic may not flow properly.
当集群的
ValidatingWebhookConfiguration
和MutatingWebhookConfiguration
所使用的主机名在 DNS 查询期间无法被解析时:apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: istio-validator-external-istiod webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://thisisnotarealdomainname.com:15017/validate name: rev.validation.istio.io --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: name: istiod-default-validator webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com:15017/validate failurePolicy: Ignore name: validation.istio.io --- apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: name: istio-sidecar-injector-external-istiod webhooks: - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: rev.namespace.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: rev.object.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: namespace.sidecar-injector.istio.io - admissionReviewVersions: - v1beta1 - v1 clientConfig: url: https://test.com/inject/cluster/your-cluster-name/net/network1 failurePolicy: Fail name: object.sidecar-injector.istio.io
您将收到消息:
Warning [IST0163] (ValidatingWebhookConfiguration istio-validator-external-istiod testing.yml:1) The hostname (https://thisisnotarealdomainname.com:15017/validate) that was provided for the webhook (rev.validation.istio.io) to reach the ingress gateway on the external control plane cluster cannot be resolved via a DNS lookup. Traffic may not flow properly.
修复方式
有多种方法可以解决这些无效配置,具体取决于配置无效的原因。
如果您的 Webhook 配置未定义 URL, 则添加使用主机名的有效 URL 将解决此警告消息。 有关如何执行此操作的说明可以在此处找到。
如果您的主机名无法通过 DNS 查找解析为 IP 地址, 您可以尝试在本地计算机上运行
dig <your-hostname>
来查看是否触发 DNS 解析。如果您的本地计算机可以通过 DNS 查询来解析主机名, 那可能是您的集群不能解析此主机名。任何阻止 DNS 流量的安全规则都可能导致解析查询失败。 新的 DNS 记录可能需要长达 72 小时才能在网络上传播, 具体取决于您的 DNS 提供商和具体配置。如果您的主机名解析为 0 个 IP 地址,请检查 Webhook URL 是否使用正确的主机名,以及您的 DNS 提供商是否正确地拥有至少一个可供您的主机名解析的 IP 地址。
IST0166: 无效的资源Selector
消息名称 | 消息代码 | 等级 | 描述 |
IneffectiveSelector | IST0166 | Warning | Selector 在应用于 Kubernetes Gateway 时不会生效。 |
当 AuthorizationPolicy
、RequestAuthentication
、Telemetry
或 WasmPlugin
这类策略中的工作负载选择器没有有效指向任何 Kubernetes Gateway Pod 目标时,会出现此消息。
异常示例
当您有一个这样的 Kubernetes Gateway Pod:
apiVersion: v1
kind: Pod
metadata:
annotations:
istio.io/rev: default
labels:
gateway.networking.k8s.io/gateway-name: bookinfo-gateway
name: bookinfo-gateway-istio-6ff4cf9645-xbqmc
namespace: default
spec:
containers:
- image: xxxxxxx-proxyv2:v1
name: istio-proxy
然后创建了以下带有 selector
的AuthorizationPolicy
:
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
namespace: default
name: ap-ineffective
spec:
selector:
matchLabels:
gateway.networking.k8s.io/gateway-name: bookinfo-gateway
action: DENY
rules:
- from:
- source:
namespaces: ["dev"]
to:
- operation:
methods: ["POST"]
您将收到消息:
Warning [IST0166] (AuthorizationPolicy default/ap-ineffective testdata/k8sgateway-selector.yaml:47) Ineffective selector on Kubernetes Gateway bookinfo-gateway. Use the TargetRef field instead.
修复方式
确保为 Sidecar 或 Istio Gateway Pod 使用 selector
字段, 并为 Kubernetes Gateway Pod 使用 targetRef
字段。 否则,此策略将不会生效。例如:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: telemetry-example
namespace: default
spec:
tracing:
- randomSamplingPercentage: 10.00
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: bookinfo-gateway
IST0167: 无效的Sidecar资源策略
消息名称 | 消息代码 | 等级 | 描述 |
IneffectivePolicy | IST0167 | Warning | 已应用的策略未生效。 |
当在 Istio 服务网格中应用的策略没有产生影响时,会出现此消息。 这可能是由于策略错误地匹配了服务网格中的工作负载或命名空间。
异常示例
若您收到以下消息:
Warning [IST0167] (Sidecar ns-ambient/namespace-scoped testdata/sidecar-default-selector.yaml:84) The policy has no
impact: namespace is in ambient mode, the policy has no impact.
Warning [IST0167] (Sidecar ns-ambient/pod-scoped testdata/sidecar-default-selector.yaml:90) The policy has no impact:
selected workload is in ambient mode, the policy has no impact.
这些消息表明 Sidecar
资源的目标是处于 Ambient 模式的工作负载或命名空间, 这意味着 Sidecar
资源中指定的策略没有任何效果。
修复方式
请确保此策略被正确定义或确定此策略是否必要。 如果命名空间或 Pod 是最近被添加 Ambient 网格中的,您可能忘记了移除不再需要的策略, 或者您可能需要更新策略的目标为正确的工作负载或命名空间。
IST0171: 资源状态异常
当前资源状态异常。