Chapter 19 updates
Signed-off-by: Lachlan Evenson <lachlan.evenson@gmail.com>
This commit is contained in:
parent
a35d445fd1
commit
2d09842027
21
19-1-kuard-pod-securitycontext.yaml
Normal file
21
19-1-kuard-pod-securitycontext.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kuard
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 3000
|
||||||
|
fsGroup: 2000
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
|
name: kuard
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
privileged: false
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
14
19-10-kuard-pod.yaml
Normal file
14
19-10-kuard-pod.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kuard
|
||||||
|
labels:
|
||||||
|
app: kuard
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
|
name: kuard
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
8
19-11-networkpolicy-default-deny.yaml
Normal file
8
19-11-networkpolicy-default-deny.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: default-deny-ingress
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
13
19-12-networkpolicy-kuard-allow-test-source.yaml
Normal file
13
19-12-networkpolicy-kuard-allow-test-source.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
kind: NetworkPolicy
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: access-kuard
|
||||||
|
spec:
|
||||||
|
podSelector:
|
||||||
|
matchLabels:
|
||||||
|
app: kuard
|
||||||
|
ingress:
|
||||||
|
- from:
|
||||||
|
- podSelector:
|
||||||
|
matchLabels:
|
||||||
|
run: test-source
|
||||||
10
19-2-amicontained-pod.yaml
Normal file
10
19-2-amicontained-pod.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: amicontained
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: jess/amicontained:v0.4.9
|
||||||
|
name: amicontained
|
||||||
|
command: [ "/bin/sh", "-c", "--" ]
|
||||||
|
args: [ "amicontained" ]
|
||||||
26
19-3-amicontained-pod-securitycontext.yaml
Normal file
26
19-3-amicontained-pod-securitycontext.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: amicontained
|
||||||
|
annotations:
|
||||||
|
container.apparmor.security.beta.kubernetes.io/amicontained: "runtime/default"
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 3000
|
||||||
|
fsGroup: 2000
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
containers:
|
||||||
|
- image: jess/amicontained:v0.4.9
|
||||||
|
name: amicontained
|
||||||
|
command: [ "/bin/sh", "-c", "--" ]
|
||||||
|
args: [ "amicontained" ]
|
||||||
|
securityContext:
|
||||||
|
capabilities:
|
||||||
|
add: ["SYS_TIME"]
|
||||||
|
drop: ["NET_BIND_SERVICE"]
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
privileged: false
|
||||||
11
19-4-baseline-ns.yaml
Normal file
11
19-4-baseline-ns.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: baseline-ns
|
||||||
|
labels:
|
||||||
|
pod-security.kubernetes.io/enforce: baseline
|
||||||
|
pod-security.kubernetes.io/enforce-version: v1.22
|
||||||
|
pod-security.kubernetes.io/audit: restricted
|
||||||
|
pod-security.kubernetes.io/audit-version: v1.22
|
||||||
|
pod-security.kubernetes.io/warn: restricted
|
||||||
|
pod-security.kubernetes.io/warn-version: v1.22
|
||||||
11
19-5-baseline-ns.yaml
Normal file
11
19-5-baseline-ns.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: baseline-ns
|
||||||
|
labels:
|
||||||
|
pod-security.kubernetes.io/enforce: baseline
|
||||||
|
pod-security.kubernetes.io/enforce-version: v1.22
|
||||||
|
pod-security.kubernetes.io/audit: restricted
|
||||||
|
pod-security.kubernetes.io/audit-version: v1.22
|
||||||
|
pod-security.kubernetes.io/warn: restricted
|
||||||
|
pod-security.kubernetes.io/warn-version: v1.22
|
||||||
14
19-6-kuard-pod.yaml
Normal file
14
19-6-kuard-pod.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kuard
|
||||||
|
labels:
|
||||||
|
app: kuard
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
|
name: kuard
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
5
19-7-service-account.yaml
Normal file
5
19-7-service-account.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: default
|
||||||
|
automountServiceAccountToken: false
|
||||||
15
19-8-kuard-pod-runtimeclass.yaml
Normal file
15
19-8-kuard-pod-runtimeclass.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kuard
|
||||||
|
labels:
|
||||||
|
app: kuard
|
||||||
|
spec:
|
||||||
|
runtimeClassName: firecracker
|
||||||
|
containers:
|
||||||
|
- image: gcr.io/kuar-demo/kuard-amd64:blue
|
||||||
|
name: kuard
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: http
|
||||||
|
protocol: TCP
|
||||||
8
19-9-networkpolicy-default-deny.yaml
Normal file
8
19-9-networkpolicy-default-deny.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: NetworkPolicy
|
||||||
|
metadata:
|
||||||
|
name: default-deny-ingress
|
||||||
|
spec:
|
||||||
|
podSelector: {}
|
||||||
|
policyTypes:
|
||||||
|
- Ingress
|
||||||
Loading…
Reference in New Issue
Block a user