@@ -140,7 +140,8 @@ In this example you'll see:
|
|||||||
First, we need to load the profile we want to use onto our nodes. The profile we'll use simply
|
First, we need to load the profile we want to use onto our nodes. The profile we'll use simply
|
||||||
denies all file writes:
|
denies all file writes:
|
||||||
|
|
||||||
{% include code.html language="text" file="deny-write.profile" ghlink="/docs/admin/apparmor/deny-write.profile" %}
|
|
||||||
|
{% include code.html language="text" file="deny-write.profile" ghlink="/docs/tutorials/clusters/deny-write.profile" %}
|
||||||
|
|
||||||
Since we don't know where the Pod will be scheduled, we'll need to load the profile on all our
|
Since we don't know where the Pod will be scheduled, we'll need to load the profile on all our
|
||||||
nodes. For this example we'll just use SSH to install the profiles, but other approaches are
|
nodes. For this example we'll just use SSH to install the profiles, but other approaches are
|
||||||
@@ -167,7 +168,7 @@ discussed in [Setting up nodes with profiles](#setting-up-nodes-with-profiles).
|
|||||||
|
|
||||||
Next, we'll run a simple "Hello AppArmor" pod with the deny-write profile:
|
Next, we'll run a simple "Hello AppArmor" pod with the deny-write profile:
|
||||||
|
|
||||||
{% include code.html language="yaml" file="hello-apparmor-pod.yaml" ghlink="/docs/admin/apparmor/hello-apparmor-pod.yaml" %}
|
{% include code.html language="yaml" file="hello-apparmor-pod.yaml" ghlink="/docs/tutorials/clusters/hello-apparmor-pod.yaml" %}
|
||||||
|
|
||||||
$ kubectl create -f /dev/stdin <<EOF
|
$ kubectl create -f /dev/stdin <<EOF
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#include <tunables/global>
|
||||||
|
|
||||||
|
profile k8s-apparmor-example-deny-write flags=(attach_disconnected) {
|
||||||
|
#include <abstractions/base>
|
||||||
|
|
||||||
|
file,
|
||||||
|
|
||||||
|
# Deny all file writes.
|
||||||
|
deny /** w,
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: hello-apparmor
|
||||||
|
annotations:
|
||||||
|
# Tell Kubernetes to apply the AppArmor profile "k8s-apparmor-example-deny-write".
|
||||||
|
# Note that this is ignored if the Kubernetes node is not running version 1.4 or greater.
|
||||||
|
container.apparmor.security.beta.kubernetes.io/hello: localhost/k8s-apparmor-example-deny-write
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: hello
|
||||||
|
image: busybox
|
||||||
|
command: [ "sh", "-c", "echo 'Hello AppArmor!' && sleep 1h" ]
|
||||||
Reference in New Issue
Block a user