码迷,mamicode.com
首页 > Web开发 > 详细

Kubernetes Resource Qoutas

时间:2018-08-28 10:30:40      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:uber   man   host   sts   val   service   内存   requests   配置   

配置参数:

  • 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: "3306"
        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

标签:uber   man   host   sts   val   service   内存   requests   配置   

原文地址:https://www.cnblogs.com/vincenshen/p/9545924.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!