apiVersion: v1
kind: Namespace
metadata:
  name: vllm
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vllm-qwen25-7b
  namespace: vllm
  labels:
    app.kubernetes.io/name: qwen25-7b
    app.kubernetes.io/component: serving-engine
spec:
  replicas: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: qwen25-7b
      app.kubernetes.io/component: serving-engine
  template:
    metadata:
      labels:
        app.kubernetes.io/name: qwen25-7b
        app.kubernetes.io/component: serving-engine
    spec:
      schedulerName: hami-scheduler
      nodeSelector:
        aliyun.accelerator/xpu_type: nvidia
      containers:
        - name: vllm
          image: egs-registry.cn-hangzhou.cr.aliyuncs.com/egs/vllm:0.20.2-pytorch2.11-cu130-20260512
          imagePullPolicy: IfNotPresent
          command:
            - vllm
            - serve
            - Qwen/Qwen2.5-7B-Instruct
            - --host
            - 0.0.0.0
            - --port
            - "8000"
            - --no-enable-prefix-caching
            - --max-model-len
            - "4096"
          env:
            - name: PYTHONHASHSEED
              value: "123"
            - name: HF_HOME
              value: /tmp
            - name: PROMETHEUS_MULTIPROC_DIR
              value: /tmp
            - name: VLLM_USE_MODELSCOPE
              value: "True"
          ports:
            - name: http
              containerPort: 8000
          resources:
            requests:
              cpu: "2"
              memory: 8Gi
            limits:
              cpu: "4"
              memory: 16Gi
              nvidia.com/gpu: "1"
              nvidia.com/gpumem: "22000"
              nvidia.com/gpucores: "100"
          startupProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 15
            periodSeconds: 10
            failureThreshold: 60
          readinessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 15
            periodSeconds: 5
          livenessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 15
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: vllm-qwen25-7b-engine-service
  namespace: vllm
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: qwen25-7b
    app.kubernetes.io/component: serving-engine
  ports:
    - name: http
      port: 80
      targetPort: http
