# 服务器错误（内部错误）：创建 "pod.yaml" 时出错：调用 Webhook "pod-identity-webhook.m8r.io" 失败：Post "https://pod-identity-webhook.m8r.io/mutate?timeout=10s"：上下文截止时间已过

- **ID:** `kubernetes/mutating-webhook-timeout`
- **领域:** kubernetes
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

可变准入 Webhook 不可达或超时，通常是由于网络问题、服务缺失或 Webhook Pod 宕机。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Kubernetes 1.26 | active | — | — |
| Kubernetes 1.27 | active | — | — |
| Kubernetes 1.28 | active | — | — |
| istio 1.18 | active | — | — |
| cert-manager 1.12 | active | — | — |

## 解决方案

1. ```
   Check webhook pod status: kubectl get pods -n <namespace> -l app=<webhook-name>, then restart if not running: kubectl rollout restart deployment/<webhook-deployment> -n <namespace>
   ```
2. ```
   Verify network connectivity by exec into a temporary pod: kubectl run test --image=busybox --rm -it -- wget -O- https://pod-identity-webhook.m8r.io/mutate --timeout=5
   ```

## 无效尝试

- **Increasing webhook timeout in the ValidatingWebhookConfiguration** — 超时通常是网络不通或服务宕机，增加超时不会解决根本问题 (75% 失败率)
- **Restarting the API server** — 问题出在 Webhook 服务端，不是 API 服务器 (90% 失败率)
- **Disabling the webhook temporarily by deleting the MutatingWebhookConfiguration** — 虽然可以绕过错误，但会禁用安全功能，且需要重新创建配置 (50% 失败率)
