k8s资源之ResourceQuota
发布一个k8s部署视频:https://edu.csdn.net/course/detail/26967课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931...
欢迎关注我的公众号:
目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:
istio防故障利器,你知道几个,istio新手不要读,太难!
不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限
不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs
不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了
不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization
不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs
不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs
不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr
不懂envoyfilter也敢说精通istio系列-08-连接池和断路器
不懂envoyfilter也敢说精通istio系列-09-http-route filter
不懂envoyfilter也敢说精通istio系列-network filter-redis proxy
不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager
不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册
————————————————
资源限制:
•kubernetes提供了两种资源限制的方式:ResourceQuota 和LimitRange。
其中ResourceQuota 是针对namespace做的资源限制,而LimitRange是针对namespace中的每个组件做的资源限制。
ResourceQuota:
•配置一个namespace可以使用的资源量
•资源配额能够对计算资源(CPU和内存)、存储资源、以及对资源对象的数量进行管理。
常用资源类型:
•计算资源配额
•存储资源配额
•对象数量配额
计算资源配额:
存储资源配额:
•requests.storage
•persistentvolumeclaims
•<storage-class-name>.storageclass.storage.k8s.io/requests.storage
•<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims
•requests.ephemeral-storage
•limits.ephemeral-storage
对象数量配额:
Quota Scopes:
示例:
[root@master01 compute-resources]# cat compute-resources.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-resources
spec:
hard:
requests.cpu: "0.1"
requests.memory: 100Mi
limits.cpu: "0.2"
limits.memory: 200Mi
[root@master01 storage]# cat storage.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: storage-resources
spec:
hard:
requests.storage: 200Mi
requests.ephemeral-storage: 1Mi
limits.ephemeral-storage: 1Mi
nfs-sc.storageclass.storage.k8s.io/requests.storage: 100Mi
nfs-sc.storageclass.storage.k8s.io/persistentvolumeclaims: 1
persistentvolumeclaims: 2
[root@master01 object-counts]# cat object-counts.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: object-counts
spec:
hard:
persistentvolumeclaims: 1
services.loadbalancers: 1
services.nodeports: 1
configmaps: 1
pods: 1
resourcequotas: 1
services: 1
secrets: 1
[root@master01 best-effort]# cat best-effort.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: best-effort
spec:
hard:
pods: "2"
scopes:
- BestEffort
[root@master01 not-best-effort]# cat not-best-effort.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: not-best-effort
spec:
hard:
pods: "2"
requests.cpu: "0.1"
requests.memory: 100Mi
limits.cpu: "0.2"
limits.memory: 200Mi
scopes:
- NotBestEffort
[root@master01 termination]# cat termination.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: termination
spec:
hard:
requests.cpu: "0.1"
requests.memory: 100Mi
limits.cpu: "0.2"
limits.memory: 200Mi
scopes:
- Terminating
[root@master01 nottermination]# cat notterminating.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: termination
spec:
hard:
requests.cpu: "0.1"
requests.memory: 100Mi
limits.cpu: "0.2"
limits.memory: 200Mi
scopes:
- NotTerminating
[root@master01 prioity-class]# cat prioity-class.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: priority-high
spec:
hard:
cpu: "0.1"
memory: 100Mi
pods: "2"
scopeSelector:
matchExpressions:
- operator : In
scopeName: PriorityClass
values: ["high"]
更多推荐
所有评论(0)