Description of problem: Set limitrange and then create a pod without resources specified, it's better to show clearer input/calculation (e.g. provided ratio) and uniform measurements (binary vs decimal math) if Pod/Container resources exceed to LimitRange. Version-Release number of selected component (if applicable): devenv-rhel_3536 oc v1.1.3-274-g209837a kubernetes v1.2.0-alpha.7-703-gbc4550d How reproducible: Always Steps to Reproduce: 1. Set limit for a project # cat limitrange.yaml apiVersion: v1 kind: LimitRange metadata: name: limitrange spec: limits: - max: cpu: 500m memory: 750Mi min: cpu: 10m memory: 5Mi maxLimitRequestRatio: cpu: 1 memory: 2 type: Pod - default: cpu: 1 memory: 4Gi defaultRequest: cpu: 110m memory: 100Mi maxLimitRequestRatio: cpu: 10 memory: 8 max: cpu: 1 memory: 4Gi min: cpu: 10m memory: 5Mi type: Container # oc create -f limitrange.yaml -n qwang1 --config=./admin.kubeconfig 2. Check limit resource # oc describe limits limitrange -n qwang1 3. Create a pod without resource specified # cat pod-no-limit-request.yaml apiVersion: v1 kind: Pod metadata: name: pod-no-limit-request labels: name: pod-no-limit-request spec: containers: - name: pod-no-limit-request image: openshift3/mysql-55-rhel7:latest env: - name: MYSQL_USER value: userSUM name: MYSQL_PASSWORD value: P5J6s8wf name: MYSQL_DATABASE value: root name: MYSQL_ROOT_PASSWORD value: W5J6s8wf resources: {} # oc create -f pod-no-limit-request.yaml -n qwang Actual results: 2. # oc describe limits limitrange -n qwang1 # oc describe limits limitrange -n qwang1 Name: limitrange Namespace: qwang1 Type Resource Min Max Default Request Default Limit Max Limit/Request Ratio ---- -------- --- --- --------------- ------------- ----------------------- Pod cpu 10m 500m - - 1 Pod memory 5Mi 750Mi - - 2 Container cpu 10m 1 110m 1 10 Container memory 5Mi 4Gi 100Mi 4Gi 8 3. It seems that dropped Pod resources are calculate by Container. For example, limit is 4294967296=4*1024*1024*1024 (Default Limit of Container), provided ratio is 40.960000=4*1024/100, (default limit/default request of Container). Could the units of measurement used in them be uniform? # oc create -f pod-no-limit-request.yaml -n qwang1 Error from server: error when creating "pod-no-limit-request.yaml": pods "pod-no-limit-request" is forbidden: [Maximum cpu usage per Pod is 500m, but limit is 1., Maximum memory usage per Pod is 750Mi, but limit is 4294967296., cpu max limit to request ratio per Pod is 1, but provided ratio is 9.090909., memory max limit to request ratio per Pod is 2, but provided ratio is 40.960000., memory max limit to request ratio per Container is 8, but provided ratio is 40.960000.] Expected results: It's helpful if show more explicit messages. Additional info:
Upstream k8s issue: https://github.com/kubernetes/kubernetes/issues/21996
Issue went stale upstream. Closing as wontfix. If any issues persist in 4.x, please open a new bug.