配置参数:

  • spec.containers[].resources.limits.cpu
  • spec.containers[].resources.limits.memory
  • spec.containers[].resources.requests.cpu
  • spec.containers[].resources.requests.memory

限制Pod CPU和Memory

apiVersion: apps/v1
kind: Deployment
metadata:
name: tomcat
spec:
replicas: 3
selector:
matchLabels:
name: tomcat
template:
metadata:
labels:
name: tomcat
spec:
containers:
- name: tomcat
image: kubeguide/tomcat-app:v1
ports:
- containerPort: 8080
env:
- name: MYSQL_SERVICE_HOST
value: "mysql"
- name: MYSQL_SERVICE_PORT
value: ""
resources:
requests:
# 内存没什么好解释的, 单位 Mi Gi
memory: 64Mi
# 千分之一的CPU配额为最小单位,用m来表示,100m表示占用0.1个cpu.
cpu: 250m
limits:
memory: 128Mi
cpu: 500m

更多详细说明:

https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#extended-resources

https://kubernetes.io/docs/concepts/policy/resource-quotas/#viewing-and-setting-quotas

Kubernetes Resource Qoutas的更多相关文章

  1. Kubernetes 实战-Operator Finalizers 实现

    原文链接:https://zdyxry.github.io/2019/09/13/Kubernetes-%E5%AE%9E%E6%88%98-Operator-Finalizers/ Finalize ...

  2. k8s pv

    这个文档描述当前在k8s中PersistentVolumes的使用. 我们建议和volume一起进行了解   Introduction     管理存储和管理计算是截然不同的问题. 持久存储子系统对用 ...

  3. k8s operator

    https://coreos.com/blog/introducing-operators.html Site Reliability Engineer(SRE)是通过编写软件来运行应用程序的人员. ...

  4. 使用k8s-prometheus-adapter实现HPA

    环境: kubernetes 1.11+/openshift3.11 自定义metric HPA原理: 首选需要注册一个apiservice(custom metrics API). 当HPA请求me ...

  5. Linkerd 2.10(Step by Step)—1. 将您的服务添加到 Linkerd

    为了让您的服务利用 Linkerd,它们还需要通过将 Linkerd 的数据平面代理(data plane proxy)注入到它们服务的 pod 中,从而进行网格化. Linkerd 2.10 中文手 ...

  6. K8S学习心得 == kube-controller-manager 报错configmaps "extension-apiserver-authentication" is forbidden: User "kubernetes" cannot get resource "configmaps" in API group ""

    当我按照教材设置证书,配置好kube-controller的相关条件后,启动kube-controller-manage组件,却意外报错. 一.基本信息如下: 1. kube-controller-m ...

  7. Kubernetes的Resource和Dashboard(十三)

    一.Resource和Dashboard 1.1.Resource 因为K8S的最小操作单元是Pod,所以这里主要讨论的是Pod的资源 官网:https://kubernetes.io/docs/co ...

  8. 【缺少kubernetes权限】 namespaces "xxx" is forbidden: User "xxx" cannot xxx resource "xxx" in API group "xxx" in the namespace "xxx"

    需要添加权限,添加权限方式: https://github.com/argoproj/argo/issues/1068

  9. Kubernetes集群搭建过程中遇到的问题

    1. 创建Nginx Pod过程中报如下错误: #kubectlcreate -f nginx-pod.yaml Error from server: error when creating &quo ...

随机推荐

  1. Classification week3: decision tree 笔记

    华盛顿大学 machine learnign :classification week 3 笔记 第二步: 注: 其中 ,mistake 的计算方法: 给定一个节点的数据集M,对每个特征hi(x),根 ...

  2. 代码备份:按模式划分椭圆轨迹渐变matlab

    x=sqrt(a^*(-y^/b^)); r=ceil(+*y); x=ceil(x); I(m/,m/+x)=+*y; elseif r== I(m/::m/+,m/+x::m/++x)=+*y; ...

  3. 爬虫-python调用百度API/requests

    from urllib.request import urlopen import requests import json url = "http://apis.baidu.com/txa ...

  4. 如何在xampp中运行php文件 (WINDOWS)

    from:http://blog.sina.com.cn/s/blog_5e87822501011os2.html 入门: 如何在xampp中运行php文件 (WINDOWS) 安装XAMPP启动ap ...

  5. Linux下IP等网络配置

    Linux下IP等网络配置: 我所知道一共三种方式,下面简单介绍(注意:网络配置必须”root管理员“登录才能进行配置). 一 1.首先在命令行输入[ifconfig]命令,可看到相关网络信息,其中” ...

  6. Python操作yaml文件

    基本的yaml语法 http://ansible-tran.readthedocs.io/en/latest/docs/YAMLSyntax.html YAML 还有一个小的怪癖. 所有的 YAML ...

  7. CMU-15445 LAB3:事务隔离,two-phase locking,锁管理器

    概述 本lab将实现一个锁管理器,事务通过锁管理器获取锁,事务管理器根据情况决定是否授予锁,或是阻塞等待其它事务释放该锁. 背景 事务属性 众所周知,事务具有如下属性: 原子性:事务要么执行完成,要么 ...

  8. 关于angularjs的复选框选中

    最近在做复选框,业务人员要求选中一块区域里的任何一个适合,复选框呈现选中状态,然而,我的复选框是ng-repeat出来的,刚开始我想用directive指令,但是不知道为什么,我一旦设置了$(this ...

  9. Pythonpika PhpAmqpLib rabbitmq服务中queues被清空的异常处理 无模式数据库对数据结构的定义和控制

    /** * Declares queue, creates if needed * * @param string $queue * @param bool $passive * @param boo ...

  10. linux下tmp目录里很多php开头的文件

    cd /tmp; ll -ash; 51M -rw------- 1 nginx nginx 51M Sep 17 09:33 php3p7FPA 51M -rw------- 1 nginx ngi ...