简体   繁体   English

GKE 在获取日志时抛出无效证书

[英]GKE throws invalid certificate when fetching logs

I'm trying to fetch the logs from a pod running in GKE, but I get this error:我正在尝试从在 GKE 中运行的 pod 中获取日志,但出现此错误:

I0117 11:42:54.468501   96671 round_trippers.go:466] curl -v -XGET  -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.26.0 (darwin/arm64) kubernetes/b46a3f8" 'https://x.x.x.x/api/v1/namespaces/pleiades/pods/pleiades-0/log?container=server'
I0117 11:42:54.569122   96671 round_trippers.go:553] GET https://x.x.x.x/api/v1/namespaces/pleiades/pods/pleiades-0/log?container=server 500 Internal Server Error in 100 milliseconds
I0117 11:42:54.569170   96671 round_trippers.go:570] HTTP Statistics: GetConnection 0 ms ServerProcessing 100 ms Duration 100 ms
I0117 11:42:54.569186   96671 round_trippers.go:577] Response Headers:
I0117 11:42:54.569202   96671 round_trippers.go:580]     Content-Type: application/json
I0117 11:42:54.569215   96671 round_trippers.go:580]     Content-Length: 226
I0117 11:42:54.569229   96671 round_trippers.go:580]     Date: Tue, 17 Jan 2023 19:42:54 GMT
I0117 11:42:54.569243   96671 round_trippers.go:580]     Audit-Id: a25a554f-c3f5-4f91-9711-3f2970376770
I0117 11:42:54.569332   96671 round_trippers.go:580]     Cache-Control: no-cache, private
I0117 11:42:54.571392   96671 request.go:1154] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Get \"https://10.6.128.40:10250/containerLogs/pleiades/pleiades-0/server\": x509: certificate is valid for 127.0.0.1, not 10.6.128.40","code":500}
I0117 11:42:54.572267   96671 helpers.go:246] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "Get \"https://10.6.128.40:10250/containerLogs/pleiades/pleiades-0/server\": x509: certificate is valid for 127.0.0.1, not 10.6.128.40",
  "code": 500
}]

How do I prevent this from happening?我如何防止这种情况发生?

One of the reasons for this error could be because both metrics-server and kubelet listen on port 10250. This is usually not a problem because metrics-server runs in its own namespace but the conflict would have prevented metrics-server from starting when in the host.network.此错误的原因之一可能是因为 metrics-server 和 kubelet 都在端口 10250 上侦听。这通常不是问题,因为 metrics-server 在其自己的命名空间中运行,但冲突会阻止 metrics-server 在主机.网络。

You can confirm this behavior by running the following command:您可以通过运行以下命令来确认此行为:

$ kubectl -n kube-system get pods -l k8s-app=metrics-server -o yaml | grep 10250
          - --secure-port=10250
          - containerPort: 10250

If you can see a hostPort: 10250 in the yaml file of the metrics-server, please run the following command to delete metrics-server deployment on that cluster:如果在 metrics-server 的 yaml 文件中看到 hostPort: 10250,请运行以下命令删除该集群上的 metrics-server 部署:

$ kubectl -n kube-system delete deployment -l k8s-app=metrics-server

Metrics server will be recreated correctly by GKE infrastructure.指标服务器将由 GKE 基础设施正确地重新创建。 It should be recreated in ~15 seconds on clusters with a new addon manager, but could take up to 15 minutes on very old clusters.它应该在使用新插件管理器的集群上大约 15 秒内重新创建,但在非常旧的集群上可能需要长达 15 分钟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GKE 可以按应用过滤日志吗? - Can GKE filter logs by application? 在 GCP Logging 中需要 GKE 部署失败日志 - Need GKE Deployment Failed Logs in GCP Logging 谷歌云 Function https 证书连接到 GKE - Google Cloud Function https certificate to connect to GKE GKE 上的 kubectl exec/logs 返回“远程错误:tls:内部错误” - kubectl exec/logs on GKE returns "remote error: tls: internal error" 带有 PubSub 的 GKE 上的 Google Healthcare API - INVALID_ARGUMENT - Google Healthcare API on GKE with PubSub - INVALID_ARGUMENT 如何找到 GKE 的控制平面日志? - How can I find GKE's control plane logs? 来自 kubectl logs 命令的 Kube.netes 日志与 GKE 集群中的 /var/log/containers 不同 - Kubernetes logs from kubectl logs command is different to /var/log/containers in GKE cluster PowerShellLibJava 正在从 docker 容器中的 java 代码中获取无效的 JSON 令牌 - PowerShellLibJava is fetching invalid JSON token from java code in docker container Vault On GKE - x509:无法验证 127.0.0.1 的证书,因为它不包含任何 IP SAN - Vault On GKE - x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs GKE 中的 Stackdriver 抛出 rpc 错误“无法导出到 Stackdriver”“超出上下文截止日期” - Stackdriver in GKE throws rpc error "Failed to export to Stackdriver" "context deadline exceeded"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM