【问题标题】:Pods starting but not working in KubernetesPod 在 Kubernetes 中启动但不工作
【发布时间】:2021-03-02 14:51:27
【问题描述】:

使用 3 个 Pod 创建了 Kubernetes 集群部署,并且一切运行良好,但是当尝试运行它们时无法做到这一点,尝试在描述部分卷曲 Pod 的 Ip(内部)我可以看到这个错误“”MountVolume.卷“default-token-twhht”的设置失败:无法同步秘密缓存:

以下错误:

5m51s       Normal    RegisteredNode      node/ip-10-1-1-4                        Node ip-10-1-1-4 event: Registered Node ip-10-1-1-4 in Controller
57m         Normal    Scheduled           pod/nginx-deployment-585449566-9bqp7    Successfully assigned default/nginx-deployment-585449566-9bqp7 to ip-10-1-1-4
57m         Warning   FailedMount         pod/nginx-deployment-585449566-9bqp7    MountVolume.SetUp failed for volume "default-token-twhht" : failed to sync secret cache: timed out waiting for the condition
57m         Normal    Pulling             pod/nginx-deployment-585449566-9bqp7    Pulling image "nginx:latest"
56m         Normal    Pulled              pod/nginx-deployment-585449566-9bqp7    Successfully pulled image "nginx:latest" in 12.092210534s
56m         Normal    Created             pod/nginx-deployment-585449566-9bqp7    Created container nginx
56m         Normal    Started             pod/nginx-deployment-585449566-9bqp7    Started container nginx
57m         Normal    Scheduled           pod/nginx-deployment-585449566-9hlhz    Successfully assigned default/nginx-deployment-585449566-9hlhz to ip-10-1-1-4
57m         Warning   FailedMount         pod/nginx-deployment-585449566-9hlhz    MountVolume.SetUp failed for volume "default-token-twhht" : failed to sync secret cache: timed out waiting for the condition
57m         Normal    Pulling             pod/nginx-deployment-585449566-9hlhz    Pulling image "nginx:latest"
56m         Normal    Pulled              pod/nginx-deployment-585449566-9hlhz    Successfully pulled image "nginx:latest" in 15.127984291s
56m         Normal    Created             pod/nginx-deployment-585449566-9hlhz    Created container nginx
56m         Normal    Started             pod/nginx-deployment-585449566-9hlhz    Started container nginx
57m         Normal    Scheduled           pod/nginx-deployment-585449566-ffkwf    Successfully assigned default/nginx-deployment-585449566-ffkwf to ip-10-1-1-4
57m         Warning   FailedMount         pod/nginx-deployment-585449566-ffkwf    MountVolume.SetUp failed for volume "default-token-twhht" : failed to sync secret cache: timed out waiting for the condition
57m         Normal    Pulling             pod/nginx-deployment-585449566-ffkwf    Pulling image "nginx:latest"
56m         Normal    Pulled              pod/nginx-deployment-585449566-ffkwf    Successfully pulled image "nginx:latest" in 9.459864756s
56m         Normal    Created             pod/nginx-deployment-585449566-ffkwf    Created container nginx

【问题讨论】:

  • 您好。考虑在代码标签中粘贴您的 Pod yaml(取出公司名称等敏感信息):以“" end after "”开头
  • 提供您的部署和配置 yaml 文件也是有益的,以便我们更深入地了解您在做什么。

标签: kubernetes devops


【解决方案1】:

您可以为 Pod 的服务帐户添加额外的 RBAC 角色权限,参考 123

还要确保您已设置工作负载身份,请参考 4


当 apiserver 处于高负载时也会发生这种情况,您可以拥有更多更小的节点来分散您的 pod 并增加您的资源请求。

【讨论】:

    【解决方案2】:

    此错误消息有点误导,因为它表明 K8s 集群内部连接问题。实际上这是一个 RBAC 权限问题。

    您要部署到的命名空间中的默认服务帐户无权将您尝试挂载到 Pod 的机密挂载。

    要解决这个问题,您必须向 Pod 的服务帐户添加额外的 RBAC 角色权限。

    【讨论】:

    • 如何添加RBAC角色并做进一步
    【解决方案3】:

    这是你的问题FailedMount pod/nginx-deployment-585449566-9bqp7 MountVolume.SetUp failed for volume "default-token-twhht" : failed to sync secret cache: timed out waiting for the condition 57m 它无法设置音量default-token-twhht

    【讨论】:

    • 是的,所以我能做些什么来解决它,任何建议都会很好,因为当我看到 master 和 slave 都准备好作为节点,并且 pod 也在运行时
    猜你喜欢
    • 2017-06-19
    • 2021-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-04
    • 2021-07-15
    • 2023-03-28
    相关资源
    最近更新 更多