Skip to content

Instantly share code, notes, and snippets.

@axeal
Created April 18, 2019 11:45
Show Gist options
  • Save axeal/4bc75d1b0e5587a810e479834420267d to your computer and use it in GitHub Desktop.
Save axeal/4bc75d1b0e5587a810e479834420267d to your computer and use it in GitHub Desktop.
Demonstrate overriding restricted PodSecurityPolicy in one namespace
apiVersion: v1
kind: Namespace
metadata:
name: psp-override
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: default-psp-role
namespace: psp-override
rules:
- apiGroups:
- extensions
resourceNames:
- default-psp
resources:
- podsecuritypolicies
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: default-psp-rolebinding
namespace: psp-override
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: default-psp-role
subjects:
- kind: ServiceAccount
name: default
namespace: psp-override
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
namespace: psp-override
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
securityContext:
privileged: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment