简体   繁体   English

使用来自不同命名空间的 Kubernetes 服务帐户

[英]use Kubernetes service account from different namespace

I have created a service account SA1 in namespace NS1 and set a full configuration for SA1 (workload identity in GCP).我在命名空间 NS1 中创建了一个服务帐户 SA1,并为 SA1(GCP 中的工作负载标识)设置了完整配置。 I need to use the service account SA1 in pods from different namespaces.我需要在来自不同命名空间的 pod 中使用服务帐户 SA1。 for now I have the pods in namespace NS1 using the SA1现在我在命名空间 NS1 中使用 SA1

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  namespace: NS1
spec:
  serviceAccountName: SA1

ServiceAccount is a namespaced resource in Kubernetes, meaning that it can only be referenced from pods deployed in the same namespace. ServiceAccount 是 Kubernetes 中的命名空间资源,这意味着它只能从部署在同一命名空间中的 pod 中引用。

This is by design, Namespaces act as logical containers on which you apply access policies and a pod in one namespace should not be able to "steal" the serviceaccount from another (possibly unrelated) namespace这是设计使然,命名空间充当您应用访问策略的逻辑容器,并且一个命名空间中的 pod 不应能够从另一个(可能不相关的)命名空间“窃取”服务帐户

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

相关问题 Kubernetes 命名空间默认服务帐户 - Kubernetes namespace default service account 限制Kubernetes服务帐户访问特定的名称空间 - Limit the Kubernetes service account access specific namespace 为 kubernetes pod 指定带有命名空间的服务帐户名称 - Specify service account name with namespace for kubernetes pod Kubernetes:无法从其他名称空间访问mongodb副本集服务 - Kubernetes: Cannot access mongodb replicaset service from a different namespace 来自不同 AWS 账户的 NLB Kubernetes 服务使用情况 - Kubernetes service usage for NLB from different AWS account Helm/Kubernetes - StatefulSet:是否可以使用来自不同命名空间的 serviceAccount - Helm/Kubernetes - StatefulSet: is that possible use serviceAccount from different namespace Openshift / Kubernetes:使用Yaml文件中的服务帐户中的令牌 - Openshift/Kubernetes: Use token from Service account in yaml file 使用 Traefik 和 Kubernetes 将流量路由到不同命名空间中的服务 - Route traffic to a service in a different namespace with Traefik and Kubernetes Kubernetes 配置:指定不同的服务帐号 - Kubernetes configuration: Specify different service account Kubernetes创建秘密并在创建名称空间时更改默认服务帐户 - Kubernetes create secret and change default service account upon namespace creation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM