- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问候各位修补匠!
我的问题是什么?
简而言之,用户 toto 不能“获得”一个 cronjob,即使权限看起来不错。更准确地说:
$> kubectl get cronjob/test -n my_namespace
Error from server (Forbidden): cronjobs.batch "test" is forbidden: User "toto" cannot get resource "cronjobs" in API group "batch" in the namespace "my_namespace"
$> kubectl auth can-i get cronjob/test -n my_namespace
no
甚至艰难:
$> kubectl auth can-i get cronjobs -n my_namespace
yes
$> kubectl auth can-i --list -n my_namespace
Resources Non-Resource URLs Resource Names Verbs
...
cronjobs.batch [] [] [get list watch list watch get]
...
$> kubectl get cronjobs -n my_namespace
NAME SCHEDULE ... AGE
test */5 * * * * 2d21h
另请注意,当由管理员级别的用户(来自组 system:masters)执行时,或者如果我将 toto 添加到组 system:masters 时,该命令工作正常。
我尝试了什么?
我添加了对所有命名空间中所有资源的完全权限,添加到 toto 所属的组(我们称它为 my_group)。事实上它甚至没有工作,这让我认为我的问题可能不是由权限引起的,而是由另一种 k8s 机制引起的。
附加信息
根据要求,这里有一些额外的信息:
$> kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T23:41:55Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.9-eks-c0eccc", GitCommit:"c0eccca51d7500bb03b2f163dd8d534ffeb2f7a2", GitTreeState:"clean", BuildDate:"2019-12-22T23:14:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
集群使用 EKS 服务托管在 AWS 上,因此:
aws-iam-authenticator
二进制文件对用户进行动态身份验证aws-auth
ConfigMap 中的组对于后两点,转换为以下 yaml 文件:
---
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
...
mapUsers: |
...
- userarn: arn:aws:iam::xxxxxxxxxxxx:user/toto
username: toto
groups:
- system:basic-user
- my_group
...
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: my_role
rules:
...
- apiGroups: ["batch"]
resources: ["cronjobs"]
resourceNames: [""]
verbs: ["list", "watch", "get"]
...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: my_rolebinding
namespace: my_namespace
subjects:
- kind: Group
name: my_group
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: my_role
apiGroup: rbac.authorization.k8s.io
最佳答案
如果我没记错的话,API 组是 batch
,资源是 cronjobs
而不是 cronjobs.batch
。
Kubernetes cluster-roles.yaml和 Kubernetes API 的文档 cronjob .
yaml
角色应该如下所示:
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
namespace: my_namespace
name: toto
rules:
- apiGroups: ["", "batch"]
resources: ["cronjobs"]
verbs: ["get", "list", "watch", "list", "watch"]
关于amazon-web-services - 库伯内斯 RBAC : can't get cronjob even though user seems to have the needed permissons,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60094996/
我已经安排了一些 cronjob。 当我执行 crontab -e 时,我会找到现有的 cronjobs。 * * * * * #Runs every minute 30 * * * * #Run
在 Linux Ubuntu 上,我有一个 python 脚本,可以在本地按时运行良好,每 5 分钟一次,用于 cronjob: */5 * * * * /usr/bin/python /matt/p
我的服务器上有一些 PHP 脚本,用于定期 cron 作业(例如,用于日常交流和更新排行榜)。 为了防止外人手动运行这些脚本(例如在浏览器中运行 http://url/script.php),我在运行
我的 crons 工作正常,我用简单的文件输出和 bash 脚本对其进行了测试,但在执行我的 python 脚本时,我没有尝试过任何工作。 所以这就是我所做的。 像往常一样,我在脚本中添加了一个 sh
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
本文通过 Google 翻译 Cron Jobs – Linux Privilege Escalation - Juggernaut-Sec 这篇文章所产生,本人仅是对机器翻译中部分表达别扭的字
我有很多 php 脚本,我想作为 cronjob 执行。这些脚本以正确的顺序执行并且不同时运行很重要。如何设置相互运行的 cronjobs? 最佳答案 每个 cron 作业都在计划运行时运行,而不管是
我对 kubernetes 很陌生,在这里我厌倦了一个 cronjob yaml,其中每 1 分钟创建一次 pod。 apiVersion: batch/v1beta1 kind: CronJob m
因此,我设置了一个 cronjob 来运行以下命令: php/var/www/path/to/cron/do-stuff.php 路径是正确的。该目录归 www-data 所有。 该脚本执行以下操作:
我在我的 Centos 7 服务器上运行了 50 多个 cronjob,就像下面给出的那样。 curl -s https://url.com/file.php 每 10 分钟运行一次。从 shell
当我通过 SSH 连接到我的 Ubuntu 6.4 VM 并运行 python nomi.py ,我的脚本按原样执行。 我按如下方式设置了我的 crontab 文件,以便每 15 分钟运行一次脚本:
我正在尝试创建一个遵循以下规则的 cronjob: 周一至周五 8:00 - 16:00 每 2 分钟 所以基本上它必须在周一到周五运行,在 8 点到 16 点之间每隔一分钟运行一次。 在这些时候,它
所以在过去的几分钟里我一直在查找 cronjobs ......我大致了解如何将一个添加到我的网站 ubuntu 系统......我需要让我的系统每分钟运行一次 Jade 米作业(根据到我正在使用的软
我正在冒险进入设置 cronjobs 的世界,并尝试了解更多关于服务器端的信息。为此,我尝试在我的服务器上设置一个 Cronjob,以便在两天内运行两个单独的 Ruby 脚本。 问题: 我将 cron
我有手动运行良好的脚本,但在通过 cronjob 运行时没有获得所需的输出。如果脚本有任何问题,请告诉我。 #!/usr/bin/ksh file1=$(find *-* -mtime 1) file
不确定我做错了什么,但我遇到了 CronJobs 停止安排新作业的问题。似乎只有在启动新作业失败几次之后才会发生这种情况。在我的特定情况下,由于无法拉取容器镜像,Jobs 无法启动。 我并没有真正找到
我创建了一个用于生成 RSS 提要的 php 脚本,该提要最终将通过 Cronjob 运行。 所有 php 文件和生成的 RSS xml 都将位于网站的子文件夹中。如果我在本地开发机器上的同一目录中使
我在这里检查了一种解决方案,但似乎找不到。我正在处理大约300kb / sec的非常慢的wan连接。对于我的下载,我使用的是远程盒,然后将其下载到我的房子。我正在尝试运行一个cronjob,它将每小时
我希望每 15 分钟触发一次作业,但它始终每 30 分钟触发一次。 更新: 我通过运行简化了问题: kubectl run hello --schedule="*/1 * * * *" --resta
我有一个时间表: schedule: "0 10,14,18 * * *" ,我想在上午 10:00、下午 2:00、下午 6:00 运行此作业。 由于我位于 UTC+8 时区,因此这个 cronjo
我是一名优秀的程序员,十分优秀!