简体   繁体   English

Kubernetes 配置:指定不同的服务帐号

[英]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.

相关问题 如何为Windows Service安装程序指定无帐户? - How to specify no account for Windows Service installer? 使用ServiceController通过其他帐户启动服务 - Use ServiceController to start a service with a different account 在使用服务证书的WCF客户端配置中指定IP服务地址 - Specify IP address of service in WCF client configuration where service certificate is used Windows服务安装程序用于不同的用户帐户(本地系统除外) - Windows service installer for different user account (other than local system) 相同的Web服务项目,不同的配置,无法调试 - Same web service project, different configuration, can't debug IIS网络用户帐户可以调用在其他帐户下运行的WCF服务吗? - Can the IIS network-user account call a WCF service running under a different account? 在.Net Remoting中,如果未在配置文件中指定远程服务或在代码中注册一个,则使用哪些默认设置? - In .Net Remoting, if you don't specify a remoting service in a configuration file or register one in code, what default settings are used? Web服务配置问题 - Web Service Configuration Problem 使用 Inno Setup 安装具有不同配置的同一 Windows 服务的多个实例 - Installing multiple instances of the same Windows service with different configuration using Inno Setup WCF服务自定义配置 - WCF Service Custom Configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM