This Helm chart deploys ComfyUI, a powerful and modular Stable Diffusion GUI, on Kubernetes. The project is open source and welcomes community contributions.
The Helm chart is optimized for deploying ComfyUI with GPU support on Kubernetes clusters. It integrates seamlessly with a provided Dockerfile, which builds a CUDA-enabled container image based on Ubuntu 22.04, ensuring optimal performance for ComfyUI.
-
Dockerfile Integration:
- Builds ComfyUI from the official repository.
- Installs necessary system and Python dependencies.
- Configures essential environment variables (
NVIDIA_DRIVER_CAPABILITIES,LD_PRELOAD,PYTHONPATH,TORCH_CUDA_ARCH_LIST,NVIDIA_VISIBLE_DEVICES). - Runs ComfyUI server with optimized settings:
python3 main.py --cuda-malloc --use-pytorch-cross-attention --listen 0.0.0.0 --port 8188
-
Kubernetes Optimized:
- Deploys Kubernetes resources: Deployment, Service, Ingress, HPA, ServiceAccount.
- Enables NVIDIA GPU support.
- Exposes application on port 8188.
- Uses a dynamically generated service account name (
{{ .Release.Name }}-saby default).
-
Customizable Image Settings:
Adjust Docker image details invalues.yaml:image: repository: your-registry/comfyui-helm tag: your-tag pullPolicy: IfNotPresent -
Flexible Service Exposure:
Supports ClusterIP, NodePort, LoadBalancer, and Ingress types.
- Kubernetes cluster with NVIDIA GPU nodes.
- Helm v3 installed.
- Docker installed for image building.
-
Configure Chart Version:
Set ComfyUI version inChart.yaml(appVersion) and optionally add an icon URL. -
Update Image Details:
Modifyvalues.yaml:image: repository: your-registry/comfyui-helm tag: your-tag pullPolicy: IfNotPresent -
Lint Chart (Optional):
helm lint . -
Deploy or Upgrade Chart:
Install:
helm install comfyui-helm . --set image.repository=your-registry/comfyui-helm,image.tag=your-tagUpgrade existing deployment:
helm upgrade comfyui-helm . --set image.repository=your-registry/comfyui-helm,image.tag=your-tag -
Horizontal Pod Autoscaler (HPA):
- HPA is enabled by default, scaling the number of pods based on CPU utilization.
- You can configure HPA settings in
values.yaml:autoscaling: enabled: true minReplicas: 1 maxReplicas: 100 targetCPUUtilizationPercentage: 80 - To disable HPA, set
autoscaling.enabledtofalse.
-
Service Exposure Options:
- ClusterIP: Default internal access; use port-forwarding externally.
- NodePort: Exposes service externally on node ports.
- LoadBalancer: Automatically provisions external IP if supported.
- Ingress: Enable and configure ingress in
values.yaml.
export POD_NAME=$(kubectl get pods -l "app.kubernetes.io/name=comfyui-helm" -o jsonpath="{.items.metadata.name}")
kubectl port-forward $POD_NAME 8188:8188
Visit http://127.0.0.1:8188.
Retrieve NodePort number:
kubectl get svc comfyui-helm -o=jsonpath='{.spec.ports[?(@.name=="http")].nodePort}'
Access via http://:.
Get external IP:
kubectl get svc comfyui-helm -o=jsonpath='{.status.loadBalancer.ingress.ip}'
Access via external IP at port 8188.
Configure ingress in values.yaml, ensure DNS setup, then access using configured hostname.
Run provided tests:
helm test comfyui-helm
This project is open source—contributions are encouraged! Fork the repository, submit issues or feature requests, and create pull requests to improve this Helm chart.
See the LICENSE file for licensing details.
For more information on ComfyUI, visit the official ComfyUI GitHub repository.