Skip to content

Instantly share code, notes, and snippets.

@rberrelleza
Created January 20, 2021 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rberrelleza/a0aab3485a386a0c98d08961e1644a5a to your computer and use it in GitHub Desktop.
Save rberrelleza/a0aab3485a386a0c98d08961e1644a5a to your computer and use it in GitHub Desktop.
Run octane on clusters that allow PSP
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: octane
spec:
allowPrivilegeEscalation: true
allowedCapabilities:
- '*'
defaultAllowPrivilegeEscalation: true
fsGroup:
rule: RunAsAny
hostIPC: true
hostNetwork: true
hostPID: true
hostPorts:
- max: 65535
min: 0
privileged: true
runAsUser:
rule: RunAsAny
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
volumes:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: octane-psp
rules:
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- octane
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: octane-psp
rules:
- apiGroups: ['policy']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
- octane
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: octane-psp
subjects:
- kind: ServiceAccount
name: "default"
namespace: octane-collector
- kind: ServiceAccount
name: "kube-netc"
namespace: octane-collector
- kind: ServiceAccount
name: "kube-state-metrics"
namespace: octane-collector
- kind: ServiceAccount
name: "octane-metrics-server"
namespace: octane-collector
- kind: ServiceAccount
name: "octane-collector"
namespace: octane-collector
roleRef:
kind: ClusterRole
name: octane-psp
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: octane-psp
subjects:
- kind: ServiceAccount
name: "default"
namespace: octane-collector
- kind: ServiceAccount
name: "kube-netc"
namespace: octane-collector
- kind: ServiceAccount
name: "kube-state-metrics"
namespace: octane-collector
- kind: ServiceAccount
name: "octane-metrics-server"
namespace: octane-collector
- kind: ServiceAccount
name: "octane-collector"
namespace: octane-collector
roleRef:
kind: Role
name: octane-psp
apiGroup: rbac.authorization.k8s.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment