apiVersion: apps/v1 kind: Deployment metadata: name: verdaccio namespace: default labels: machine: library app: verdaccio spec: replicas: 1 selector: matchLabels: app: verdaccio template: metadata: labels: app: verdaccio machine: library spec: # 指定调度到特定节点 nodeSelector: machine: library # 或者使用 nodeAffinity(更灵活,推荐用于生产) # affinity: # nodeAffinity: # requiredDuringSchedulingIgnoredDuringExecution: # nodeSelectorTerms: # - matchExpressions: # - key: kubernetes.io/hostname # operator: In # values: # - vm-32-6-ubuntu containers: - name: verdaccio image: verdaccio/verdaccio:latest ports: - containerPort: 4873 volumeMounts: - name: verdaccio-storage mountPath: /verdaccio/storage - name: verdaccio-config mountPath: /verdaccio/conf env: - name: VERDACCIO_PORT value: "4873" resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "256Mi" cpu: "200m" volumes: - name: verdaccio-storage hostPath: path: /opt/docker/verdaccio/data/storage type: DirectoryOrCreate - name: verdaccio-config hostPath: path: /opt/docker/verdaccio/data/conf