简体   繁体   English

将角色传递给运行在 kube.netes 上的 docker 容器

[英]Pass Role to docker container running on kubernetes

I am running a self hosted kube.netes cluster on AWS.我在 AWS 上运行一个自托管的 kube.netes 集群。 I want to pass AWS IAM roles to containers.我想将 AWS IAM 角色传递给容器。

Right now what we do is, a role is given to all the worker nodes and the containers running on the machines would get the credentials from the machine itself.现在我们所做的是,为所有工作节点分配一个角色,并且在机器上运行的容器将从机器本身获取凭据。

This creates an issue.这就产生了一个问题。 I have to allow a superset of all the permissions required by all the containiers that are running in the cluster.我必须允许集群中运行的所有容器所需的所有权限的超集。 so if there is one container that requires a permission to a S3 bucket and an other container that requires permissions to SQS then I need to give both the permissions to the cluster.因此,如果有一个容器需要 S3 存储桶的权限,而另一个容器需要 SQS 的权限,那么我需要同时授予集群权限。 This in turn gives all the permissions to all the containers running in the cluster, which is not desirable.这反过来又将所有权限授予集群中运行的所有容器,这是不可取的。

So my question is that is there a way to pass different roles to individual containers.所以我的问题是有没有办法将不同的角色传递给各个容器。

I know we can use Access keys and Secret keys to do this.我知道我们可以使用访问密钥和秘密密钥来做到这一点。 I am looking for a way to do this without using them.我正在寻找一种无需使用它们即可执行此操作的方法。

If you run your containers in EKS you can pass IAM roles to Pods binding them to k8s Service Accounts, see here如果您在 EKS 中运行您的容器,您可以将 IAM 角色传递给 Pod,将它们绑定到 k8s 服务帐户,请参见此处

For self-managed clusters there are 3rd-party open-source projects solving the same issue kiam and kube-aws-iam-controller对于自我管理的集群,有解决相同问题的第 3 方开源项目kiamkube-aws-iam-controller

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

相关问题 如何让容器在 Kubernetes 上运行? - How can I keep a container running on Kubernetes? Jenkins 在 Docker 容器中运行但无法在浏览器上启动它 - Jenkins running in Docker Container but unable to launch it on browser Angular 2 应用程序部署在 AWS 上运行的 docker 容器中 - Angular 2 app deploy in a docker Container running on AWS Cloud composer 使用 Kube.netesPodOperator 在 Kube.netes pod 中运行 Docker 图像 - Cloud composer running Docker image inside Kubernetes pod using KubernetesPodOperator 将 AWS 凭证传递给 Docker 容器的最佳方式是什么? - What is the best way to pass AWS credentials to a Docker container? 如何将谷歌云应用程序凭据文件传递给 docker 容器 - How to pass google cloud application credentials file to docker container 将 Go 服务器作为 Docker 容器运行时出现权限被拒绝错误 - Permission denied error when running Go server as Docker container 如何使用 intelliJ 中的 AWS 工具包将文件复制到运行 Lambda 的 docker 容器 - How to copy file to docker container running Lambda with AWS Toolkit in intelliJ 如何为在 AWS ECS 中运行的 Docker 容器配置“ulimits”? - How do I configure "ulimits" for a Docker container running in AWS ECS? Kube.netes CronJob 与边车容器 - Kubernetes CronJob with a sidecar container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM