Apparmor
Step 0: Install Apparmor
sudo apt install apparmor-easyprof apparmor-notify apparmor-utils certspotterStep 1: Lets Create a Simple Apparmor Profile.
Ensure this profile should be available in the system where ever the pod with apparmor annotation is running
sudo apparmor_parser -q <<EOF
#include <tunables/global>
profile k8s-apparmor-example-deny-write flags=(attach_disconnected) {
#include <abstractions/base>
file,
# Deny all file writes.
deny /** w,
}
EOFStep 2: Verify the status of the profile:
sudo aa-statusStep 3: Sample YAML File based on Host PID:
mkdir apparmor && cd apparmorStep 4: Apply the Pod Manifest file
Verify if the Pod is running or not. If you see the Pod in "Blocked" State, identify why the pod is blocked.
If the Apparmor profile is not present in the Worker node on which the pod is running, the pod go to blocked state.
In Case if your pod is running then verify the logs of pod
Step 5: Verification Stage
Inside the Pod Shell, run the following
You should get permission denied Error, when you run the above command.
List the Apparmor Profiles
Remove the Apparmore Profile
Disbale Apparmor
Last updated
Was this helpful?