Security Context Constraints(SCC) capabilities setting for Generic Storage Backup and Restore with OCP 4.11 or higher

This article describes Security Context Constraints(SCC) capabilities that need to be added to use Generic Backup and Restore feature capabilities on OCP 4.11 and higher,

With OCP 4.11, default security context constraints (SCC) have changed. Due to this, when using Generic Storage Backup and Restore with OCP 4.11 or higher, the following error message might be seen

“Failed to exec command in pod: command terminated with exit code 255”

Full error message

[{\"name\":\"FailedSubPhases\",\"value\":[{\"Err\":{\"cause\":{\"cause\":{\"cause\":{\"cause\":{\"cause\":{\"message\":\"{\\\"message\\\":\\\"Failed to backup data\\\",\\\"function\\\":\\\"kasten.io/k10/kio/kanister/function.(*backupDataFunc).Exec\\\",\\\"linenumber\\\":122,\\\"file\\\":\\\"kasten.io/k10/kio/kanister/function/backup_data.go:122\\\",\\\"cause\\\":{\\\"message\\\":\\\"2 errors have occurred\\\",\\\"errors\\\":[{\\\"message\\\":\\\"Failed to create the backup repository\\\",\\\"function\\\":\\\"kasten.io/k10/kio/kopia.CreateKopiaRepository\\\",\\\"linenumber\\\":472,\\\"file\\\":\\\"kasten.io/k10/kio/kopia/repository.go:472\\\",\\\"cause\\\":{\\\"message\\\":\\\"Failed to exec command in pod: command terminated with exit code 255\\\"}},{\\\"message\\\":\\\"Failed to connect to the backup repository\\\",\\\"function\\\":\\\"kasten.io/k10/kio/kopia.ConnectToKopiaRepository\\\",\\\"linenumber\\\":558,\\\"file\\\":\\\"kasten.io/k10/kio/kopia/repository.go:558\\\",\\\"cause\\\":{\\\"message\\\":\\\"Failed to exec command in pod: command terminated with exit code 255\\\"}}]}}\"}

To continue using Generic Storage Backup feature on OCP 4.11 and higher and to resolve the error shown above, security context constraints(SCC) capabilities need to be added manually to the container spec as shown below 

securityContext:
capabilities:
add: ["CAP_CHOWN", "CAP_DAC_OVERRIDE", "CAP_FOWNER"]

If container spec changes are not permitted, update the allowedCapabilities field in SCC as shown below

allowedCapabilities:

- CHOWN
- DAC_OVERRIDE
- FOWNER

 

Note: Backups will be unavailable until the changes are completed