Skip to content

Commit

Permalink
add pod security policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Fuller committed Feb 19, 2019
1 parent 3f17e92 commit e6913b1
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions k8s/backend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
labels:
app: pong-backend
spec:
serviceAccountName: queue-app
containers:
- name: queue-backend
image: benjamintf1/queue-backend:latest
Expand Down
13 changes: 13 additions & 0 deletions k8s/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: queue-app
rules:
- apiGroups:
- policy
resources:
- podsecuritypolicies
resourceNames:
- queue-app
verbs:
- use
1 change: 1 addition & 0 deletions k8s/frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
labels:
app: pong-frontend
spec:
serviceAccountName: queue-app
containers:
- name: queue-frontend
image: benjamintf1/queue-frontend:latest
Expand Down
17 changes: 17 additions & 0 deletions k8s/psp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: queue-app
spec:
privileged: false
seLinux:
rule: RunAsAny
supplementalGroups:
rule: RunAsAny
runAsUser:
rule: RunAsAny
fsGroup:
rule: RunAsAny
volumes:
- '*'

13 changes: 13 additions & 0 deletions k8s/role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: queue-app
subjects:
- kind: ServiceAccount
name: queue-app
namespace: default
roleRef:
kind: ClusterRole
name: queue-app
apiGroup: rbac.authorization.k8s.io

4 changes: 4 additions & 0 deletions k8s/service-account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: queue-app

0 comments on commit e6913b1

Please sign in to comment.