kubernetes: pod created failed when devices resource request is 0

What happened?

1 create deployment by yaml below

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jktest
spec:
  selector:
    matchLabels:
      workload.es.io: jktest
  template:
    metadata:
      labels:
        workload: jktest
    spec:
      containers:
      - image: centos:latest
        imagePullPolicy: IfNotPresent
        name: test
        resources:
          limits:
            cpu: 250m
            memory: 512Mi
            nvidia.com/gpu: "0"
          requests:
            cpu: 250m
            memory: 512Mi
            nvidia.com/gpu: "0"

2 create pod failed, the reason is

status:
  message: >-
    Pod Node didn't have enough resource: nvidia.com/gpu, requestd: 0, used: 1,
    capacity: 0
  phase: Failed
  reason: OutOfnvidia.com/gpu
  startTime: '2022-02-02T12:40:19Z'  

What did you expect to happen?

expect the pod create success, the request resource is 0, and it must not exceed

so it failed by somewhere unreasonable judgment

How can we reproduce it (as minimally and precisely as possible)?

1 create pod a which use hot pluggable device in resource.request, and the resource is 1 2 remove device 3 create pod b which use hot pluggable device in resource.request, and the ressource is 0

Anything else we need to know?

No response

Kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.15", GitCommit:"4a89df5617b8e1e26abb16150502d04e6c180533", GitTreeState:"clean", BuildDate:"2022-03-26T06:34:08Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

kubespray

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here

Install tools

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 20 (17 by maintainers)

Most upvoted comments

Why you set nvidia.com/gpu as 0, if you don’t want to request the resource.