首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >k8 pod优先级和测试

k8 pod优先级和测试
EN

Stack Overflow用户
提问于 2020-08-18 09:20:34
回答 1查看 143关注 0票数 1

这些是我优先考虑的类

代码语言:javascript
运行
复制
NAME                      VALUE        GLOBAL-DEFAULT   AGE
k8-monitoring             1000000      false            4d7h
k8-system                 500000       false            4d7h
k8-user                   1000         false            4d7h

我正在尝试在命名空间pod配额的范围内测试优先级,如果方法是正确的,可以有人确认我吗?如果没有,请给我指点一下。

代码语言:javascript
运行
复制
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中运行此测试,但没有获得设计中解释的优先级。我的直觉告诉我,如果我需要用另一只眼睛看它

应该看不到这个,高优先级应该正在运行

代码语言:javascript
运行
复制
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的优秀解决方案。

EN

回答 1

Stack Overflow用户

发布于 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。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63460576

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档