example-daemon.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # The example DaemonSet demonstrating how the profile loader can be deployed onto a cluster to
  2. # automatically load AppArmor profiles from a ConfigMap.
  3. apiVersion: apps/v1
  4. kind: DaemonSet
  5. metadata:
  6. name: apparmor-loader
  7. # Namespace must match that of the ConfigMap.
  8. namespace: apparmor
  9. labels:
  10. daemon: apparmor-loader
  11. spec:
  12. selector:
  13. matchLabels:
  14. daemon: apparmor-loader
  15. template:
  16. metadata:
  17. name: apparmor-loader
  18. labels:
  19. daemon: apparmor-loader
  20. spec:
  21. containers:
  22. - name: apparmor-loader
  23. image: google/apparmor-loader:latest
  24. args:
  25. # Tell the loader to pull the /profiles directory every 30 seconds.
  26. - -poll
  27. - 30s
  28. - /profiles
  29. securityContext:
  30. # The loader requires root permissions to actually load the profiles.
  31. privileged: true
  32. volumeMounts:
  33. - name: sys
  34. mountPath: /sys
  35. readOnly: true
  36. - name: apparmor-includes
  37. mountPath: /etc/apparmor.d
  38. readOnly: true
  39. - name: profiles
  40. mountPath: /profiles
  41. readOnly: true
  42. volumes:
  43. # The /sys directory must be mounted to interact with the AppArmor module.
  44. - name: sys
  45. hostPath:
  46. path: /sys
  47. # The /etc/apparmor.d directory is required for most apparmor include templates.
  48. - name: apparmor-includes
  49. hostPath:
  50. path: /etc/apparmor.d
  51. # Map in the profile data.
  52. - name: profiles
  53. configMap:
  54. name: apparmor-profiles