Scenario:
Your vmware-system-user account expired on vSphere Supervisor Workload Cluster nodes.
You show similar symptoms as mentioned in KB 319375
You attempt to Change the vmware-system-user password expiry on Existing Clusters using the cluster-admin DaemonSet yaml provided in KB 319375.
The DaemonSet fails to deploy.
You see the following error:
Warning FailedCreate 3s (x5 over 41s) daemonset-controller (combined from similar events): Error creating: pods "cluster-admin-#####" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (containers "init", "sleep" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (containers "init", "sleep" must set securityContext.capabilities.drop=["ALL"]), restricted volume types (volume "hostfs" uses restricted volume type "hostPath"), runAsNonRoot != true (pod or containers "init", "sleep" must set securityContext.runAsNonRoot=true), seccompProfile (pod or containers "init", "dynatrace-operator", "sleep" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
You note that you are utilizing Dynatrace in your environment.
You might also be using Kyverno or other PSA policies as well.
Tanzu Kubernetes Service
NOTE:
Regarding the message "restricted:latest" reported in the above error scenario, the Operator was also using Kyverno with a policy on all of their clusters to prevent users from using the latest tag on their images. However, we just needed to ensure having the correct labels on the new namespace to deploy the cluster-admin DaemonSet.
Resolution summary:
For this specific issue, you would create a new K8s namespace in the cluster and ensure that the appropriate labels were added to that new namespace.
Resolution Procedure:
Example namespace name: temp-namespace
Include the following namespace labels:
pod-security.kubernetes.io/audit=restricted
pod-security.kubernetes.io/enforce=privileged
pod-security.kubernetes.io/warn=baseline
For example:
namespace: temp-namespace