这些是我优先考虑的类
NAME VALUE GLOBAL-DEFAULT AGE
k8-monitoring 1000000 false 4d7h
k8-system 500000 false 4d7h
k8-user 1000 false 4d7h我正在尝试在命名空间pod配额的范围内测试优先级,如果方法是正确的,可以有人确认我吗?如果没有,请给我指点一下。
apiVersion: v1
kind: Namespace
metadata:
name: priority-test
---
apiVersion: v1
kind: ResourceQuota
metadata:
name: priority-pod-quota
namespace: priority-test
spec:
hard:
pods: "5"
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: user-priority
namespace: priority-test
labels:
tier: x3
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: x3
template:
metadata:
labels:
tier: x3
spec:
priorityClassName: k8-user
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: system-priority
namespace: priority-test
labels:
tier: x2
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: x2
template:
metadata:
labels:
tier: x2
spec:
priorityClassName: k8-system
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: monitoring-priority
namespace: priority-test
labels:
tier: x1
spec:
# modify replicas according to your case
replicas: 3
selector:
matchLabels:
tier: x1
template:
metadata:
labels:
tier: x1
spec:
priorityClassName: monitoring-priority
containers:
- name: php-redis
image: gcr.io/google_samples/gb-frontend:v3我在EKS v.1.15中运行此测试,但没有获得设计中解释的优先级。我的直觉告诉我,如果我需要用另一只眼睛看它
应该看不到这个,高优先级应该正在运行
NAME DESIRED CURRENT READY AGE
monitoring-priority 3 0 0 17m
system-priority 3 2 2 17m
user-priority 3 3 3 17m我也读过Dawid Kruk K8s pod priority & outOfPods的优秀解决方案。
发布于 2020-08-18 10:42:23
您已将具有5个pods的ResourceQuota定义为hard要求。此ResourceQuota在名称空间级别应用于所有pods,而不考虑它们的优先级。这就是为什么你在user-priority中看到3个pod作为current,在system-priority中看到2个pod。由于ResourceQuota中定义的5个pods的限制,其余的pods无法运行。如果您检查kubectl get events,您应该会看到与资源配额相关的403 FORBIDDEN错误。
ResourceQuota是一个准入控制器,当达到配额时,它根本不会让pod进入调度队列,这就是现在正在发生的事情。因此,您需要增加ResourceQuota配额才能进行实例优先级和抢占测试。
测试pod优先级和抢占的正确方法是部署足够的pod以达到节点资源容量,并验证是否正在逐出低优先级pod以调度高优先级pod。
https://stackoverflow.com/questions/63460576
复制相似问题