zoukankan      html  css  js  c++  java
  • kubernetes基础知识:限制POD和容器运行的CPU、内存

    限制运行内存

    https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/

    先看一个pod的yaml文件(官方提供)

    apiVersion: v1
    kind: Pod
    metadata:
      name: memory-demo
      namespace: mem-example
    spec:
      containers:
      - name: memory-demo-ctr
        image: polinux/stress
        resources:
          limits:
            memory: "200Mi"
          requests:
            memory: "100Mi"
        command: ["stress"]
        args: ["--vm", "1", "--vm-bytes", "150M", "--vm-hang", "1"]
    

      

    限制CPU

    https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/

    先来看个官方例子

    apiVersion: v1
    kind: Pod
    metadata:
      name: cpu-demo
      namespace: cpu-example
    spec:
      containers:
      - name: cpu-demo-ctr
        image: vish/stress
        resources:
          limits:
            cpu: "1"
          requests:
            cpu: "0.5"
        args:
        - -cpus
        - "2"
    

      

  • 相关阅读:
    小猪存钱罐
    SSL与HTTPS协议
    KVM之XFS磁盘扩容
    vue学习笔记(一)
    ant打包总结
    github上传代码总结
    java中map遍历的总结
    angularjs初学总结
    angularjs常用指令
    github上传代码总结
  • 原文地址:https://www.cnblogs.com/yaochc/p/9334351.html
Copyright © 2011-2022 走看看