How to Deploy a CPU‑Based Stable Diffusion Service on Alibaba Cloud ACK

This guide walks you through the prerequisites, step‑by‑step console and kubectl procedures, YAML configuration, and post‑deployment verification needed to run a CPU‑only Stable Diffusion model on Alibaba Cloud Container Service (ACK) and optionally switch to a GPU‑enabled version.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
How to Deploy a CPU‑Based Stable Diffusion Service on Alibaba Cloud ACK

Prerequisites

A pre‑created Alibaba Cloud Container Service (ACK) Kubernetes managed cluster. CPU deployment requires a node with at least 8 CPU × 16 GB RAM; GPU deployment requires a GPU node with >40 GB free disk.

kubectl configured to access the cluster.

Stable Diffusion Docker image hosted at

zibai-registry.cn-hangzhou.cr.aliyuncs.com/gpt/stable-diffusion

(CPU tag v1.cpu, GPU tag v1.gpu).

CPU version deployment via console

Log in to the Container Service Management Console and select the target cluster.

Navigate to Workloads → Stateless and click Create from Image .

Enter basic application information (name, namespace, etc.) and confirm.

After the workload is created, go to Network → Services and create a Service of type LoadBalancer .

Wait ~1 minute for an external IP to be allocated, then refresh the service page to view the External IP column.

Access the UI at http://<ExternalIP>:7860.

CPU version deployment via kubectl

apiVersion: apps/v1
kind: Deployment
metadata:
  name: stable-diffusion
  namespace: default
  labels:
    app: stable-diffusion
spec:
  replicas: 1
  selector:
    matchLabels:
      app: stable-diffusion
  template:
    metadata:
      labels:
        app: stable-diffusion
    spec:
      containers:
      - name: stable-diffusion
        image: zibai-registry.cn-hangzhou.cr.aliyuncs.com/gpt/stable-diffusion:v1.cpu
        imagePullPolicy: IfNotPresent
        command: ["python3", "launch.py"]
        args: ["--listen", "--skip-torch-cuda-test", "--no-half"]
        resources:
          requests:
            cpu: "2"
            memory: 2Gi
---
apiVersion: v1
kind: Service
metadata:
  name: stable-diffusion
  namespace: default
  annotations:
    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: internet
    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-instance-charge-type: PayByCLCU
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
  - port: 7860
    protocol: TCP
    targetPort: 7860
  selector:
    app: stable-diffusion
kubectl apply -f stable-diffusion.yaml

Monitor pod status with kubectl get po | grep stable-diffusion and retrieve the load balancer IP with kubectl get svc stable-diffusion. The CPU image is ~12.7 GB and typically downloads in ~10 minutes.

GPU version deployment

Create a GPU‑enabled ACK cluster (node must have a GPU and >40 GB free disk).

apiVersion: apps/v1
kind: Deployment
metadata:
  name: stable-diffusion
  namespace: default
  labels:
    app: stable-diffusion
spec:
  replicas: 1
  selector:
    matchLabels:
      app: stable-diffusion
  template:
    metadata:
      labels:
        app: stable-diffusion
    spec:
      containers:
      - name: stable-diffusion
        image: zibai-registry.cn-hangzhou.cr.aliyuncs.com/gpt/stable-diffusion:v1.gpu
        imagePullPolicy: IfNotPresent
        command: ["python3", "launch.py"]
        args: ["--listen", "--skip-torch-cuda-test", "--no-half"]
        resources:
          requests:
            cpu: "2"
            memory: 2Gi
          limits:
            nvidia.com/gpu: 1
---
apiVersion: v1
kind: Service
metadata:
  name: stable-diffusion
  namespace: default
  annotations:
    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: internet
    service.beta.kubernetes.io/alibaba-cloud-loadbalancer-instance-charge-type: PayByCLCU
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
  - port: 7860
    protocol: TCP
    targetPort: 7860
  selector:
    app: stable-diffusion
kubectl apply -f stable-diffusion.yaml

After the pod becomes ready, the GPU image (~15.1 GB) typically downloads in ~15 minutes. Access the UI at the same http://<ExternalIP>:7860; image generation is noticeably faster than the CPU version.

Notes

Image pull times are measured up to 2023‑05‑17.

Image repository:

zibai-registry.cn-hangzhou.cr.aliyuncs.com/gpt/stable-diffusion

.

Reference implementation: https://github.com/AUTOMATIC1111/stable-diffusion-webui

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KubernetesStable DiffusionCPUGPUAI Model DeploymentloadbalancerACK
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.