Pod rejected under Pod Security Admission
Symptom
An instance is created, the StatefulSets appear, but no pods are created. The StatefulSet reports a failure to create pods, with a Pod Security Admission violation naming the restricted profile. Typical wording in events:
The instance's own status may show no error, because the objects the operator submitted were accepted; it is the pods that are refused.
Reproduce the condition by checking the namespace labels:
A pod-security.kubernetes.io/enforce: restricted label is the trigger.
Cause
Setting logVolumeClaimTemplate changes the pod's shape: the operator appends a second container named clickhouse-log so the log volume can be read without disturbing the server. The container it generates sets only a user id in its security context. It does not set allowPrivilegeEscalation: false, drop capabilities, or set a seccomp profile, and the restricted profile requires all of those.
Every other container in the pod can be fully compliant and the pod is still rejected, because admission judges the whole pod.
Fix
Declare the log container yourself in the pod template, with a complete security context. When a container with that exact name already exists, the operator reuses yours instead of generating one — it only fills in the image if you left it empty or set it to default.
The name must be exactly clickhouse-log. A different name leaves you with both your sidecar and the operator's generated container, and the rejection stands.
Alternative: do not persist logs
If you do not need logs on a volume, remove logVolumeClaimTemplate. Without it the operator does not add the log container at all, and mounts an emptyDir at the log directory instead. Logs are then readable for the life of the pod and lost when it is replaced.
Verify
Two containers, clickhouse and clickhouse-log, both with a complete security context.
ClickHouse is a registered trademark of ClickHouse, Inc. https://clickhouse.com
Alauda is an independent vendor. This product is not affiliated with, endorsed by, or sponsored by ClickHouse, Inc. All trademarks are the property of their respective owners and are used here for identification purposes only.