namespace pod quota 命名空间资源配额

设置命名空间中运行的Pod总数量的配额

当前环境

  • OS Version: Ubuntu 16.04.2
  • Docker Version: 17.12.1
  • Kubernetes Version: binary 1.10.1

当前命名空间pods=4

$ kubectl get po
alpine                   1/1       Running   0          3d
mysql-748ccddf77-4pb2p   1/1       Running   0          11h
nginx-54b6dcd86f-5qrbv   1/1       Running   0          12m
nginx-54b6dcd86f-ct455   1/1       Running   0          13m

由于nginx副本为2, 现在scale=0

$ kubectl scale deployment nginx --replicas=0
$ kubectl get po
alpine                   1/1       Running   0          3d
mysql-748ccddf77-4pb2p   1/1       Running   0          11h

设置命名空间pods资源总数量配额pods=3

apiVersion: v1
kind: ResourceQuota
metadata:
  name: pod-demo
spec:
  hard:
    pods: "3"

重新扩容nginx, scale=2, 因为命名空间配额为3, 所以nginx只会启动一个pod, 并不会报错

$ kubectl scale deployment nginx --replicas=2
$ kubectl get po
alpine                   1/1       Running   0          3d
mysql-748ccddf77-4pb2p   1/1       Running   0          12h
nginx-54b6dcd86f-4cdrs   1/1       Running   0          6s

你可能感兴趣的:(namespace pod quota 命名空间资源配额)