gpt4 book ai didi

kubernetes - 我可以在一个命名空间中创建一个 Pod,它使用来自另一个命名空间的服务帐户吗?

转载 作者:行者123 更新时间:2023-12-05 03:43:31 27 4
gpt4 key购买 nike

我在命名空间 Foo 中有一个 pod,在命名空间 Bar 中有一个服务帐户。我可以将 pod 作为来自其他 namespace 的服务帐户运行吗?或者 pod 和服务帐户属于不同命名空间这一事实会阻止我吗?

最佳答案

不,你不能。您的 Pod 和服务帐户需要在同一个命名空间中。因为,服务帐户和 Pod 是命名空间

就 k8s 文档而言:

When you create a pod, if you do not specify a service account, it is automatically assigned the default service account in the same namespace. The service account has to exist at the time the pod is created, or it will be rejected.

这也是合乎逻辑的事情,因为它们是命名空间对象。所以它们需要在同一个命名空间中。

您无法更新已创建的 pod 的服务帐户。

可以看到k8s doc还有this

关于kubernetes - 我可以在一个命名空间中创建一个 Pod,它使用来自另一个命名空间的服务帐户吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66748535/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com