pod.containers.spec.resources 不起作用(限制和请求)Kubernetes
pod.containers.spec.resources doesn't work (limits and requests) Kubernetes
我正在尝试在我的 pod 定义中使用资源限制和请求,但好像调度程序不想应用我的规范:
kind: Pod
apiVersion: v1
metadata:
name: pod-lab5
namespace: limit-namespace
labels:
app: stress
spec:
containers:
- name: resources-limit
image: dkuffner/docker-stress
command: ["stress"]
args: ["--vm", "1", "--vm-bytes", "50M", "--vm-hang", "1"]
resources:
requests:
memory: "60Mi"
cpu: "70m"
limits:
memory: "65Mi"
cpu: "75m"
requests:
ephemeral-storage: "2Gi"
limits:
ephemeral-storage: "4Gi"
当我使用限制范围时,它采用默认规格:
apiVersion: v1
kind: LimitRange
metadata:
name: mylimits
namespace: limit-namespace
spec:
limits:
- max:
cpu: 100m
memory: 100Mi
min:
cpu: 40m
memory: 20Mi
type: Pod
- default:
cpu: 80m
memory: 70Mi
defaultRequest:
cpu: 60m
memory: 50Mi
max:
cpu: 100m
memory: 100Mi
min:
cpu: 40m
memory: 20Mi
type: Container
谁能帮帮我?谢谢:)
我认为这只是相同参数的重复问题。
resources:
requests:
memory: "60Mi"
cpu: "70m"
limits:
memory: "65Mi"
cpu: "75m"
requests:
ephemeral-storage: "2Gi"
limits:
ephemeral-storage: "4Gi"
修改如下,然后再测试
resources:
requests:
memory: "60Mi"
cpu: "70m"
ephemeral-storage: "2Gi"
limits:
memory: "65Mi"
cpu: "75m"
ephemeral-storage: "4Gi"
我正在尝试在我的 pod 定义中使用资源限制和请求,但好像调度程序不想应用我的规范:
kind: Pod
apiVersion: v1
metadata:
name: pod-lab5
namespace: limit-namespace
labels:
app: stress
spec:
containers:
- name: resources-limit
image: dkuffner/docker-stress
command: ["stress"]
args: ["--vm", "1", "--vm-bytes", "50M", "--vm-hang", "1"]
resources:
requests:
memory: "60Mi"
cpu: "70m"
limits:
memory: "65Mi"
cpu: "75m"
requests:
ephemeral-storage: "2Gi"
limits:
ephemeral-storage: "4Gi"
apiVersion: v1
kind: LimitRange
metadata:
name: mylimits
namespace: limit-namespace
spec:
limits:
- max:
cpu: 100m
memory: 100Mi
min:
cpu: 40m
memory: 20Mi
type: Pod
- default:
cpu: 80m
memory: 70Mi
defaultRequest:
cpu: 60m
memory: 50Mi
max:
cpu: 100m
memory: 100Mi
min:
cpu: 40m
memory: 20Mi
type: Container
谁能帮帮我?谢谢:)
我认为这只是相同参数的重复问题。
resources:
requests:
memory: "60Mi"
cpu: "70m"
limits:
memory: "65Mi"
cpu: "75m"
requests:
ephemeral-storage: "2Gi"
limits:
ephemeral-storage: "4Gi"
修改如下,然后再测试
resources:
requests:
memory: "60Mi"
cpu: "70m"
ephemeral-storage: "2Gi"
limits:
memory: "65Mi"
cpu: "75m"
ephemeral-storage: "4Gi"