[英]requests through the Kubernetes cluster by OPA
I want to use OPA(Open Policy Agent) in kubernetes but have some questions which are not still clear for me:我想在 kubernetes 中使用 OPA(开放策略代理),但有一些问题我还不清楚:
Let's take a look at a specific case together: for instance, there is a pod creation in a namespace and we can know the namespace from the pod object at OPA.我们一起来看一个具体的案例:比如在一个命名空间中创建了一个 pod,我们可以从 OPA 的 pod object 中知道命名空间。 But, can we get the namespace object separately to learn the authority which this namespace belongs to?
但是,我们可以单独获取命名空间 object 来了解这个命名空间所属的权限吗?
More explicitly, I mean can we do requests through the Kubernetes cluster by OPA?更明确地说,我的意思是我们可以通过 OPA 通过 Kubernetes 集群进行请求吗?
for instance, there is a pod creation with the name of Test.例如,有一个名为 Test 的 pod 创建。 I just want to allow this creation for only an authority called TestAuthority.
我只想允许这个创建只用于一个名为 TestAuthority 的权限。 When the pod is created, we know the namespace data but not the authority.
创建 Pod 时,我们知道命名空间数据,但不知道权限。 To figure out the authority which this pod belongs to, I need to have the namespace object and look out its labels.
为了弄清楚这个 pod 所属的权限,我需要有命名空间 object 并查看它的标签。 Can we do so by OPA?
我们可以通过 OPA 这样做吗?
Additionally, can we say allow pod creation with the names of Test1, Test2, and Test3?此外,我们是否可以说允许使用 Test1、Test2 和 Test3 的名称创建 pod? So, any pod creation with the name of Test4 should be denied.
因此,应该拒绝任何名称为 Test4 的 pod 创建。
Thank you in advance for your help预先感谢您的帮助
(1) Yes, see https://github.com/open-policy-agent/kube-mgmt#caching or https://github.com/open-policy-agent/gatekeeper#replicating-data depending on which integration you are wanting to use. (1) 是的,请参阅https://github.com/open-policy-agent/kube-mgmt#caching或https://github.com/open-policy-agent/gatekeeper#replicating-data取决于您的集成想用。 Both allow replicating objects from kubernetes into OPA to reference in the policies.
两者都允许将对象从 kubernetes 复制到 OPA 以在策略中引用。
(2) Yes, you can write policies like that. (2) 是的,您可以编写这样的策略。
credit:Patrick East answered from OPA Slack信用:Patrick East 从 OPA Slack 回答
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.