- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在设置 CI/CD 管道,以自动部署基于 Kubernetes 的应用程序。此部署的一部分涉及创建其他服务帐户及其相关角色。
当我的管道运行时,部署失败并显示以下错误消息:
Error: roles.rbac.authorization.k8s.io "mongodb-kubernetes-operator" is forbidden: user "cicd-bot@my-project.iam.gserviceaccount.com" (groups=["system:authenticated"]) is attempting to grant RBAC permissions not currently held:
│ {APIGroups:[""], Resources:["configmaps"], Verbs:["list" "watch" "create" "update" "patch" "get" "delete"]}
│ {APIGroups:[""], Resources:["pods"], Verbs:["list" "watch" "create" "update" "patch" "get" "delete"]}
│ {APIGroups:[""], Resources:["secrets"], Verbs:["list" "watch" "create" "update" "patch" "get" "delete"]}
│ {APIGroups:[""], Resources:["services"], Verbs:["list" "watch" "create" "update" "patch" "get" "delete"]}
│ {APIGroups:["apps"], Resources:["statefulsets"], Verbs:["list" "watch" "create" "update" "patch" "get" "delete"]}
│ {APIGroups:["mongodbcommunity.mongodb.com"], Resources:["mongodbcommunity"], Verbs:["list" "watch" "update" "patch" "get"]}
│ {APIGroups:["mongodbcommunity.mongodb.com"], Resources:["mongodbcommunity/finalizers"], Verbs:["list" "watch" "update" "patch" "get"]}
│ {APIGroups:["mongodbcommunity.mongodb.com"], Resources:["mongodbcommunity/spec"], Verbs:["list" "watch" "update" "patch" "get"]}
│ {APIGroups:["mongodbcommunity.mongodb.com"], Resources:["mongodbcommunity/status"], Verbs:["list" "watch" "update" "patch" "get"]}
│
│ with module.db_document.kubernetes_role.operator_mongodb,
│ on modules/db_document/main.tf line 17, in resource "kubernetes_role" "operator_mongodb":
│ 17: resource "kubernetes_role" "operator_mongodb" {
│
错误看起来很简单:我的服务帐户无法授予它没有的权限。由于错误消息提到了我的 GCP 服务帐户 cicd-bot@my-project.iam.gserviceaccount.com
,我在我的角色定义中添加了我认为是匹配权限的内容。
以下是我的最终角色。它具有 configMaps、pod、secrets、services、statefulsets 和 thirdPartyObjects 的创建、删除、获取、列出和更新权限,我认为这些应该满足要求。
resource "google_project_iam_custom_role" "cicd_bot_role" {
project = var.project
role_id = "cicd_bot"
title = "CICD Bot"
permissions = [
"artifactregistry.repositories.downloadArtifacts",
"artifactregistry.repositories.uploadArtifacts",
"compute.instanceGroupManagers.get",
"container.clusters.get",
"container.configMaps.create",
"container.configMaps.delete",
"container.configMaps.get",
"container.configMaps.list",
"container.configMaps.update",
"container.cronJobs.create",
"container.cronJobs.delete",
"container.cronJobs.get",
"container.cronJobs.update",
"container.customResourceDefinitions.create",
"container.customResourceDefinitions.delete",
"container.customResourceDefinitions.get",
"container.customResourceDefinitions.list",
"container.customResourceDefinitions.update",
"container.deployments.create",
"container.deployments.delete",
"container.deployments.get",
"container.deployments.update",
"container.ingresses.create",
"container.ingresses.delete",
"container.ingresses.get",
"container.ingresses.update",
"container.jobs.create",
"container.jobs.delete",
"container.jobs.get",
"container.jobs.update",
"container.namespaces.get",
"container.persistentVolumeClaims.create",
"container.persistentVolumeClaims.delete",
"container.persistentVolumeClaims.get",
"container.persistentVolumeClaims.update",
"container.pods.create",
"container.pods.delete",
"container.pods.get",
"container.pods.list",
"container.pods.update",
"container.roleBindings.create",
"container.roleBindings.delete",
"container.roleBindings.get",
"container.roleBindings.update",
"container.roles.create",
"container.roles.delete",
"container.roles.get",
"container.roles.update",
"container.secrets.create",
"container.secrets.delete",
"container.secrets.get",
"container.secrets.list",
"container.secrets.update",
"container.serviceAccounts.create",
"container.serviceAccounts.delete",
"container.serviceAccounts.get",
"container.serviceAccounts.update",
"container.services.create",
"container.services.delete",
"container.services.get",
"container.services.list",
"container.services.update",
"container.statefulSets.create",
"container.statefulSets.delete",
"container.statefulSets.get",
"container.statefulSets.list",
"container.statefulSets.update",
"container.thirdPartyObjects.create",
"container.thirdPartyObjects.delete",
"container.thirdPartyObjects.get",
"container.thirdPartyObjects.list",
"container.thirdPartyObjects.update",
"dns.changes.create",
"dns.changes.get",
"dns.resourceRecordSets.get",
"dns.resourceRecordSets.list",
"dns.resourceRecordSets.update",
"storage.buckets.get",
"storage.objects.create",
"storage.objects.delete",
"storage.objects.get",
"storage.objects.list",
]
}
然而,部署后,错误仍然存在。我想知道是否有必要在 kubernetes 端添加等效权限,所以我也创建了以下 ClusterRole 和 ClusterRoleBinding。
resource "kubernetes_cluster_role" "cicd_bot" {
metadata {
name = kubernetes_service_account.cicd_bot.metadata[0].name
}
rule {
api_groups = [""]
resources = ["namespaces"]
verbs = ["create", "delete", "get"]
}
rule {
api_groups = [""]
resources = ["configmaps"]
verbs = ["list", "watch", "create", "update", "patch", "get", "delete"]
}
rule {
api_groups = [""]
resources = ["pods"]
verbs = ["list", "watch", "create", "update", "patch", "get", "delete"]
}
rule {
api_groups = [""]
resources = ["secrets"]
verbs = ["list", "watch", "create", "update", "patch", "get", "delete"]
}
rule {
api_groups = [""]
resources = ["services"]
verbs = ["list", "watch", "create", "update", "patch", "get", "delete"]
}
rule {
api_groups = ["apps"]
resources = ["statefulsets"]
verbs = ["list", "watch", "create", "update", "patch", "get", "delete"]
}
rule {
api_groups = ["mongodbcommunity.mongodb.com"]
resources = ["mongodbcommunity"]
verbs = ["list", "watch", "update", "patch", "get"]
}
rule {
api_groups = ["mongodbcommunity.mongodb.com"]
resources = ["mongodbcommunity/finalizers"]
verbs = ["list", "watch", "update", "patch", "get"]
}
rule {
api_groups = ["mongodbcommunity.mongodb.com"]
resources = ["mongodbcommunity/spec"]
verbs = ["list", "watch", "update", "patch", "get"]
}
rule {
api_groups = ["mongodbcommunity.mongodb.com"]
resources = ["mongodbcommunity/status"]
verbs = ["list", "watch", "update", "patch", "get"]
}
}
resource "kubernetes_cluster_role_binding" "cicd_bot" {
metadata {
name = kubernetes_service_account.cicd_bot.metadata[0].name
}
subject {
kind = "ServiceAccount"
namespace = kubernetes_service_account.cicd_bot.metadata[0].namespace
name = kubernetes_service_account.cicd_bot.metadata[0].name
}
role_ref {
api_group = "rbac.authorization.k8s.io"
kind = "ClusterRole"
name = kubernetes_cluster_role.cicd_bot.metadata[0].name
}
}
不幸的是,管道仍然失败并出现同样的错误。过去我已经能够克服类似的错误,但这次不行。我错过了什么?
更新:我能够通过将角色 roles/container.admin
附加到我的服务帐户来成功部署。所以现在我需要弄清楚哪些权限 roles/container.admin
具有我的自定义角色没有的权限。
最佳答案
可悲的是,缺少的一个权限是
container.roles.escalate
即使包括所有其他 container.*
权限也是不够的;仍然需要 container.roles.escalate
。
这很不幸,因为它使集群更容易受到权限升级攻击。如果有更安全的方法来实现这一点,我很乐意听到。我不会将自己的答案标记为“正确”,因为我对此不满意。但是,嘿,至少它在工作......
关于kubernetes - GCP GKE : Service account "is attempting to grant RBAC permissions not currently held",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71992187/
尝试从对话框中的 EditText 获取 Edit Text 的值,但一次又一次地出现此错误 Attempt to invoke virtual method 'android.text.Editab
最近尝试了一下最新的Laravel(6.4)。正在尝试实现基于 API 的简单登录功能。没有使用 Passport 或 Tymon 的 JWT 等任何软件包。我使用了非常基本的身份验证(只需在用户表中
最近尝试了一下最新的Laravel(6.4)。正在尝试实现基于 API 的简单登录功能。没有使用 Passport 或 Tymon 的 JWT 等任何软件包。我使用了非常基本的身份验证(只需在用户表中
我在我的 PC 上运行 cifar10 网络,在完成训练和运行评估脚本后出现以下错误: 2016-06-01 14:37:14.238317: precision @ 1 = 0.000 Traceb
我正在使用 ng2-toastr 并收到以下错误 https://www.npmjs.com/package/ng2-toastr Attempt to use a destroyed view: d
env file:环境文件: APP_ENV=localAPP_DEBUG=trueAPP_KEY= ...........DB_HOST=srv3.linuxisrael.co.ilDB_D
当我登录管理员时,我正在尝试对 api 进行多重保护身份验证,我得到了跟随错误 BadMethodCallException Method Illuminate\Auth\Req uestGuard:
我开始在 Lua 中进行编程,并在运行脚本时出现此错误: attempt to index upvalue 'base' (a function value) 这可能是因为我还没有掌握一些非常基本的东
我试图在 Oozie 工作流中聚合一些数据。但是聚合步骤失败。 我在日志中发现了两个兴趣点:第一个是一个似乎重复出现的错误(?): 容器完成后,它会被杀死,但会以非零退出代码 143 退出。 它完成了
我的问题是当我调用函数时: [self performSegueWithIdentifier: @"FinalPlayPT" sender: self]; 它有效,但我有这个警告: Warning:
项目背景 项目整体采用的是springboot+mybatis 方式。有一次做数据查询的时候。console突然报:DataIntegrityViolationException: Error att
我在使用 Jobs 发送电子邮件的 Ubuntu Server 上设置了 Laravel 项目。 下面是我在 中的 laravel-worker 文件/etc/supervisor/laravel-w
尝试运行我的 React 应用程序时收到以下错误: ./src/components/App/App.js Attempted import error: 'combineReducers' is n
我的编码功能是这样的: fn encode_login(packet: &str) { let bytes = packet.as_bytes(); for (i, &element)
如果一个版本号大于另一个版本号,我的 msbuild 需要采取有条件的操作。我尝试像下面这样编写代码,但发现出现错误(也在下面)。我哪里出错了?
我是 Lua 的新手,并试图让事情在我的脑海中进行排序。我试过这个代码: function newCarousel(images) local slideToImage = function(
我正在使用 entrust用于在 Laravel 5.3 中管理基于角色的权限,并自然地为不同的用户类型使用手动/自定义登录。 Auth::attempt()可以吗?处理外表关系?基本上,我想做这样的
我谷歌了一遍又一遍,但没有对我有用的信息。 情况是这样的:1.产品有 active 。2.我通过测试账号来测试我的apk。3.我已经上传了一整天的apk。 但是当我想为应用程序中的项目付款时,goog
我正在尝试使用 groovy 解析日期字符串,但遇到了问题。这是字符串的样子和不起作用的逻辑。 def dateString = "2017-01-01T12:00:00Z" def date = D
我正在使用 ParseFacebookUtils 从 Facebook 登录我的应用。 LoginActivity 的 onCreate: protected void onCreate(Bundle
我是一名优秀的程序员,十分优秀!