• K8S 容器的资源需求、资源限制


    容器的资源需求,资源限制

    • requests:需求,最低保障;
    • limits:限制,硬限制;

    CPU:
    1 颗逻辑 CPU
    1=1000,millicores
    500m=0.5CPU

    QoS:

    1. Guranteed : 每个容器 同时设置CPU和内存的requests和limits
      即 :cpU.limits=cpu.request, memory.limits=memory.requests
    2. Burstable:至少有一个容器设置CPU或内存资源的requests属性
    3. BestEffort:没有任何一个容器设置了requests或limits属性
    # 查看节点上的 taint
    kubectl describe nodes node1 |grep -E '(Roles|Taints)'
    kubectl describe nodes node2 |grep -E '(Roles|Taints)'
    
    kubectl taint node node1 node-type-
    kubectl taint node node2 node-type-
    
    mkdir ~/metrics ; cd ~/metrics
    
    vi pod-demo.yaml
    apiVersion: v1
    kind: Pod
    metadata:
      name: pod-demo
      labels:
        app: myapp
        tier: frontend
    spec:
      containers:
      - name: myapp
        image: ikubernetes/stress-ng
        command: ["/usr/bin/stress-ng", "-c 1", "--metrics-brief"]
        resources:
          requests:
            cpu: "200m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
    
    kubectl apply -f pod-demo.yaml 
    
    kubectl exec pod-demo -- top
    
    # 查看 Qos
    kubectl describe pod pod-demo|grep "QoS Class"
    
  • 相关阅读:
    HDU-4035 Maze
    poj 3744 Scout YYF I
    HDU 4911 Inversion
    HDU-3001 Travelling
    HDU 4539 郑厂长系列故事——排兵布阵
    poj 3311 Hie with the Pie
    poj-1185 炮兵阵地
    位运算
    HDU-1438 钥匙计数之一
    poj 3254 Corn Fields
  • 原文地址:https://www.cnblogs.com/klvchen/p/10042978.html
Copyright © 2020-2023  润新知