题目要求
在 qutt 命名空间,创建一个名为 myquota 的 Quota,该资源 Quota 具有 1 个CPU, 1G 内存和 2个 pod的硬限制。
参考
https://kubernetes.io/zh-cn/docs/concepts/policy/resource-quotas/#viewing-and-setting-quotas
解答
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| kubectl create ns qutt
kubectl create quota myquota --hard=count/pods=2 --namespace=qutt --dry-run=client -o yaml > 25-resource-quota.yaml
vim 25-resource-quota.yaml apiVersion: v1 kind: ResourceQuota metadata: creationTimestamp: null name: myquota namespace: qutt spec: hard: limits.cpu: "1" limits.memory: 1Gi count/pods: "2" status: {}
kubectl apply -f 25-resource-quota.yaml
kubectl -n qutt describe quota myquota Name: myquota Namespace: qutt Resource Used Hard -------- ---- ---- count/pods 0 2 limits.cpu 0 1 limits.memory 0 1Gi
|