惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
量子位
博客园 - 司徒正美
IT之家
IT之家
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
Vercel News
Vercel News
B
Blog
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
小众软件
小众软件
罗磊的独立博客
博客园 - 叶小钗
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学

博客园 - 初级编程

大模型的好处 消息中转站 历史朝代表 沙箱-guacamole 这是个神奇的博客 Tomcat Access Log 的格式 CA证书 记一次性能调优 web系统能力培养计划 金融知识学习 读《华为区块链白皮书》 马未都说收藏:陶瓷篇(8、9)元青花、永宣青花 阿里历年面试试题 回车(CR)换行(LF)的来历及区别 马未都说收藏:陶瓷篇(6、7)宋代八大民窑 马未都说收藏:陶瓷篇-常见瓷器器形分类 马未都说收藏:陶瓷篇(3、4、5)宋瓷-官窑-汝官哥钧定 【转载】Java并发编程:volatile关键字解析 陶瓷相关书籍
kubernetes基础知识:限制POD和容器运行的CPU、内存
初级编程 · 2018-07-19 · via 博客园 - 初级编程

限制运行内存

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"