[英]Kubernetes configuration: Specify different service account
I develop a .NET API and I want to deploy it in a Kubernetes pod.我开发了一个 .NET API,我想将它部署在 Kubernetes 吊舱中。 I'm using InClusterConfig():我正在使用 InClusterConfig():
var config = KubernetesClientConfiguration.InClusterConfig();
_client = new Kubernetes(config);
I follow this issue ( Accessing kubernetes service from C# docker ) and I understand that InClusterConfig uses the default service account of the namespace where you are deploying the pod.我关注此问题( 从 C# docker 访问 kubernetes 服务)并且我了解 InClusterConfig 使用您部署 pod 的命名空间的默认服务帐户。
Is it possible to specify that the configuration is taken from another service account than default?是否可以指定配置来自另一个服务帐户而不是默认值? Are there other methods to retrieve configuration from a Kubernetes pod?还有其他方法可以从 Kubernetes pod 中检索配置吗?
The Pod will use the ServiceAccount specified in the Pod-manifest, if not specified the default
ServiceAccount in the namespace will be used. Pod 将使用 Pod-manifest 中指定的 ServiceAccount,如果未指定,将使用命名空间中的default
ServiceAccount。
You can specify the ServiceAccount for a Pod with the serviceAccountName:
-field:您可以使用serviceAccountName:
-field 为 Pod 指定 ServiceAccount:
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
serviceAccountName: my-service-account
...
Also see Configure Service Accounts for Pods另请参阅为 Pod 配置服务帐户
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.