Create a Pod called non-root-pod
, image: redis:alpine
runAsUser: 1000fsGroup: 2000
Pod non-root-pod fsGroup configured
Pod non-root-pod runAsUser configured
https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
piVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: non-root-pod
name: non-root-pod
spec:
securityContext:
runAsUser: 1000
fsGroup: 2000
containers:
- image: redis:alpine
name: non-root-pod
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}