This topic shows how to deploy a ComfyUI application on an Alibaba Cloud Container Service for Kubernetes (ACK) managed Pro cluster that has GPU-accelerated nodes. Deploying on ACK overcomes the performance bottlenecks and complex environment setup associated with running it locally.
Prerequisites
You have an ACK managed Pro cluster running Kubernetes version 1.22 or later. The cluster must also include GPU-accelerated nodes, each with at least 16 GB of GPU memory.
The NVIDIA driver version is 535 or later. This topic uses an example where the
ack.aliyun.com/nvidia-driver-versionlabel is added to the GPU node pool with the value550.144.03.
Step 1: Prepare the model data
In this example, we will use the sdxl-turbo model. It creates images from your text prompts in just one step. The following steps show how to download the model, upload it to Object Storage Service (OSS), and create a Persistent Volume (PV) and Persistent Volume Claim (PVC) in the ACK cluster for persistent storage.
Download the model file.
Install Git and the Git Large File Storage (LFS) extension.
macOS
Install Git.
The officially maintained macOS Git installer is available from the official Git website.
brew install gitInstall the Git LFS extension to pull large files.
brew install git-lfs
Windows
Install Git.
Download and install a suitable version from the official Git website.
Install the Git LFS extension to pull large files. Git LFS is integrated into Git for Windows. Download and use the latest version.
Linux
Install Git.
The following command is for Red Hat-based Linux distributions. For other systems, see the official Git website.
yum install gitInstall the Git LFS extension to pull large files.
yum install git-lfs
Download the
sdxl-turbomodel.GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/AI-ModelScope/sdxl-turbo.git cd sdxl-turbo git lfs pull
Upload the downloaded
sdxl-turbofolder to OSS.ossutil is a command-line tool for managing OSS resources.
Create an OSS bucket.
If you do not have a bucket, create one by running the following command. Replace
<Your-Bucket-Name>with a globally unique name for your bucket.ossutil mb oss://<Your-Bucket-Name>Create a directory within the bucket.
Create a directory namedsdxl-turboinside your bucket to store the model files.ossutil mkdir oss://<Your-Bucket-Name>/sdxl-turboUpload the model files.
Run the following command from the directory where you downloaded the model to recursively copy all files into the OSS directory you just created.ossutil cp -r ./sdxl-turbo oss://<Your-Bucket-Name>/sdxl-turbo
Create a PV for the model data.
Log on to the ACK console and go to the cluster details page.
In the left navigation pane, choose .
On the Persistent Volumes page, click Create, and configure the following parameters:
PV Type: Select OSS
Volume Name: Enter
sdxl-turbo-modelCapacity: Enter
20GiAccess Mode: Select ReadWriteMany
Access Certificate: Select Create Secret
Optional Parameters: Enter
-o umask=022 -o max_stat_cache_size=0 -o allow_otherBucket ID: Select the bucket where you uploaded the model.
OSS Path: Enter
/sdxl-turboEndpoint: Select Internet Endpoint
Click Create.
Create a PVC to bind to the PV.
In the left navigation pane of the ACK console, choose .
On the Persistent Volume Claims page, click Create, and configure the following parameters:
PVC Type: Select OSS
Name: Enter
sdxl-turbo-modelAllocation Mode: Select Existing Volumes
Existing Volumes: Select the
sdxl-turbo-modelPV you just created.Capacity: 20 Gi
Click Create. The
sdxl-turbo-modelPVC will appear in the list with a bound status.
Step 2: Configure the ComfyUI application
Log on to the ACK console. In the left navigation pane, click Clusters.
On the Clusters page, click the name of the target cluster. In the left navigation pane, choose .
On the Helm page, click Deploy. Find the comfyui component, configure the parameters as needed, and click Next.

In the Parameters step, scroll to the
persistencesection and modify it to use the PVC you created for the model files. Leave all other settings as default.persistence: - mountPath: "/app/ComfyUI/models/checkpoints" # Mount path for the model annotations: helm.sh/resource-policy: keep persistentVolumeClaim: existingClaim: "sdxl-turbo-model" # Use the PVC created earlier accessModes: ReadWriteMany storageClass: oss # Specify the storage type as OSS size: 20Gi subPath: ""Change the model source:
mountPath: "/app/ComfyUI/models/checkpoints".Change the PVC to the one you created:
existingClaim: "sdxl-turbo-model".Change the storage class:
storageClass: oss.
Step 3: Access and test the service
Use
kubectlto forward the ComfyUI service to local port 8080.Ensure port 8080 is not in use on your local machine. Keep the terminal window open to maintain the port forwarding connection.
kubectl port-forward svc/ack-comfyui 8080:8188Expected output:
Forwarding from 127.0.0.1:8080 -> 8188 Forwarding from [::1]:8080 -> 8188Open a web browser and navigate to
http://localhost:8080.Download the sdxl-turbo example workflow. On the ComfyUI page, click
Loadand select the workflow file you just downloaded..In the CLIP Text Encode (Prompt) text box, enter your desired prompt, for example:
beautiful landscape scenery glass bottle with a galaxy inside cute fennec fox snow HDR sunsetOn the ComfyUI page, enable
Extra OptionsandAuto Queuein the settings. Then, clickQueue Promptto generate an image.