k8spspcapabilities
Basic Information
Function
The allowedCapabilities and requiredDropCapabilities fields in PodSecurityPolicy are restricted.
Policy Example
The following policy instance shows the types of resources for which the policy definition takes effect. The allowedCapabilities and requiredDropCapabilities lists are defined in parameters.
apiVersion: constraints.gatekeeper.sh/v1beta1 kind: K8sPSPCapabilities metadata: name: capabilities-demo spec: match: kinds: - apiGroups: [""] kinds: ["Pod"] namespaces: - "default" parameters: allowedCapabilities: ["something"] requiredDropCapabilities: ["must_drop"]
Resource Definition That Complies with the Policy
In this example, the capabilities parameters comply with the policy instance.
apiVersion: v1 kind: Pod metadata: name: opa-allowed labels: owner: me.agilebank.demo spec: containers: - name: opa image: openpolicyagent/opa:0.9.2 args: - "run" - "--server" - "--addr=localhost:8080" securityContext: capabilities: add: ["something"] drop: ["must_drop", "another_one"] resources: limits: cpu: "100m" memory: "30Mi"
Resource Definition That Does Not Comply with the Policy
In this example, the capabilities parameters do not comply with the policy instance.
apiVersion: v1 kind: Pod metadata: name: opa-disallowed labels: owner: me.agilebank.demo spec: containers: - name: opa image: openpolicyagent/opa:0.9.2 args: - "run" - "--server" - "--addr=localhost:8080" securityContext: capabilities: add: ["disallowedcapability"] resources: limits: cpu: "100m" memory: "30Mi"
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot