You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a Kubernetes Operator anti-pattern for these reasons:
Declarative Mismatch: Hardcoding breaks Kubernetes’ declarative model, reducing flexibility and forcing redeployments for changes.
Reduced Flexibility: Users can’t easily customize pods without modifying the operator itself.
Operator Role: Operators should automate operational knowledge, not act as static YAML deployment tools.
Maintenance Complexity: Embedded manifests complicate testing, maintenance, and reusability.
PROBLEM STATEMENT
This anti-pattern also led to issues in our secure runtime stack. Our service mesh, Istio, must be implemented to secure ingress/egress using NetPols via internal CRs, adding another layer of defense to all services within the cluster. There are no exceptions to this rule, and all namespaces should have Istio injection enabled, with explicit and justified pod-level exclusions (e.g., certain jobs)
Ultimately, our modifications described in the above paragraph were successful in allowing the validations to run, complete, and continue/finish the NVIDIA GPU Operator deployment without further issues, all while allowing Istio injection in the gpu-operator namespace.
As a bonus issue, the resources and limits are inconsistently applied to the initContainers and containers within both validation workload pods.
RECOMMENDATIONS
Use CRDs, ConfigMaps, or straight helm chart templates to drive resource creation dynamically for flexibility and separation of concerns.
Modify the existing, hard-coded deployment manifests for the validation pods to allow for lower-level templating in the metadata, security context, and resources, to name a few.
ADDITIONAL CONTEXT
Please note that it may also be possible to post-patch a ConfigMap with these particular hard-coded manifests into the daemonset as well.
apiVersion: v1kind: Podmetadata:
labels:
app: nvidia-cuda-validatorsidecar.istio.io/inject: "false"# added line of most importance, other additions are secondarygenerateName: nvidia-cuda-validator-namespace: "FILLED_BY_THE_VALIDATOR"spec:
tolerations:
- key: nvidia.com/gpuoperator: Existseffect: NoSchedulerestartPolicy: OnFailureserviceAccountName: nvidia-operator-validatorinitContainers:
- name: cuda-validationimage: "FILLED_BY_THE_VALIDATOR"imagePullPolicy: IfNotPresentcommand: ["sh", "-c"]args: ["vectorAdd"]env:
- name: NVIDIA_VISIBLE_DEVICESvalue: "all"securityContext:
privileged: true# add resources and limitsresources:
requests:
cpu: 50mmemory: 32Milimits:
cpu: 100mmemory: 64Micontainers:
- name: nvidia-cuda-validatorimage: "FILLED_BY_THE_VALIDATOR"imagePullPolicy: IfNotPresent# override command and args as validation is already done by initContainercommand: ["sh", "-c"]args: ["echo cuda workload validation is successful"]securityContext:
privileged: truereadOnlyRootFilesystem: true# add resources and limitsresources:
requests:
cpu: 50mmemory: 32Milimits:
cpu: 100mmemory: 64Mi
The text was updated successfully, but these errors were encountered:
justinthelaw
changed the title
bug: operator anti-pattern, validator hard-coded pod deployments
bug: operator anti-pattern, validator pod deployments cause CrashBackLoop behaviour
Nov 13, 2024
HOST INFORMATION
DESCRIPTION
The NVIDIA GPU Operator validator contains hard-coded deployments of the CUDA validation and Plugin validation pods within the gpu-operator-validator daemonset's container. There is no way to influence the way these pods are deployed via values files, nor is there an easy way to manipulate the workload pods via post-deploy actions (e.g.,
kubectl delete
), else the validation daemonset fails.This is a Kubernetes Operator anti-pattern for these reasons:
PROBLEM STATEMENT
This anti-pattern also led to issues in our secure runtime stack. Our service mesh, Istio, must be implemented to secure ingress/egress using NetPols via internal CRs, adding another layer of defense to all services within the cluster. There are no exceptions to this rule, and all namespaces should have Istio injection enabled, with explicit and justified pod-level exclusions (e.g., certain jobs)
To this end, we had to modify the existing gpu-operator-validator Dockerfile and validation workload pod manifests to explicitly, instead of broadly, exclude sidecar injection in the validation pods, else they would hang indefinitely. There was no way to do a post-deployment patch to end the validation pods so that the deployment would continue. Our efforts, e.g., post-deploy cron-jobs, lead to the gpu-operator-validator daemonset going into a pseudo-CrashBackLoop, where it would re-deploy the validation workload pods again every 5 minutes or it would go into an actual CrashBackLoop, ending the advancement of the overall deployment altogether.
Ultimately, our modifications described in the above paragraph were successful in allowing the validations to run, complete, and continue/finish the NVIDIA GPU Operator deployment without further issues, all while allowing Istio injection in the
gpu-operator
namespace.As a bonus issue, the resources and limits are inconsistently applied to the initContainers and containers within both validation workload pods.
RECOMMENDATIONS
ADDITIONAL CONTEXT
Please note that it may also be possible to post-patch a ConfigMap with these particular hard-coded manifests into the daemonset as well.
Modified Dockerfile
Example CUDA validation workload manifest
The text was updated successfully, but these errors were encountered: