Skip to main content
Seccomp stands for secure computing mode and has been a feature of the Linux kernel since version 2.6.12. It can be used to sandbox the privileges of a process, restricting the calls it is able to make from userspace into the kernel. Refer the Kubernetes Seccomp Guide for more details. In this guide we are going to configure a custom Seccomp Profile that logs all syscalls made by the workload.

Prepare the nodes

Create a machine config patch with the contents below and save as patch.yaml
Apply the machine config to all the nodes using talosctl:
This would create a seccomp profile named audit.json on the node at /var/lib/kubelet/seccomp/profiles. The profiles can be used by Kubernetes pods by specifying the pod securityContext as below:
Note that the localhostProfile uses the name of the profile created under profiles directory. So make sure to use path as profiles/<profile-name.json>
This can be verified by running the below commands:
An output similar to below can be observed:
The content of the seccomp profile can be viewed by running the below command:
An output similar to below can be observed:

Create a Kubernetes workload that uses the custom Seccomp profile

Here we’ll be using an example workload from the Kubernetes documentation. First open up a second terminal and run the following talosctl command so that we can view the Syscalls being logged in realtime:
Now deploy the example workload from the Kubernetes documentation:
Once the pod starts running the terminal running talosctl dmesg command from above should log similar to below:

Cleanup

You can clean up the test resources by running the following command: