File tree Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Expand file tree Collapse file tree 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 1
- # Configuring pods to run securely
1
+ # Policies
2
+
3
+ One important tool in the defense in depth strategy are policies. These define
4
+ what is or is not allowed and part of it is usually an enforcement component.
5
+
6
+ In the context of policies, the concept of least privileges is an important one.
7
+ So let's have a look at this.
2
8
3
9
## Least privileges
4
10
5
- http://canihaznonprivilegedcontainers.info/
11
+ First off we start with the simple case of a Kubernetes security context,
12
+ allowing you to specify runtime policies around privileges and access control.
13
+
14
+ We will be using an [ example from the Kubernetes docs] ( https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ )
15
+ so that you can read up on the details later on.
16
+
17
+ ```
18
+ kubectl apply -f
19
+ https://raw.githubusercontent.com/k8s-sec/cloud-native-security-tutorial/master/res/pod-security-context.yaml
20
+ ```
21
+
22
+ See more at http://canihaznonprivilegedcontainers.info/
6
23
7
24
## Network policies
8
25
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Pod
3
+ metadata :
4
+ name : security-context
5
+ spec :
6
+ securityContext :
7
+ runAsUser : 1000
8
+ runAsGroup : 3000
9
+ fsGroup : 2000
10
+ volumes :
11
+ - name : datavol
12
+ emptyDir : {}
13
+ containers :
14
+ - name : main
15
+ image : amazonlinux:2
16
+ command : [ "sh", "-c", "sleep 3600" ]
17
+ volumeMounts :
18
+ - name : datavol
19
+ mountPath : /data
20
+ securityContext :
21
+ allowPrivilegeEscalation : false
You can’t perform that action at this time.
0 commit comments