I’m trying to apply a Kubernetes Deployment
manifest on a namespace
that contains a quota
called compute-resources, with only the limits.cpu set.
kubectl -n <namesapce> describe quota compute-resources
Name: compute-resources
Namespace: stage-pctest
Resource Used Hard
-------- ---- ----
limits.cpu 17512m 400
When I apply a Deployment
manifest, with the resources.limits.cpu
set, I get a Error creating: pods “” is forbidden: failed quota: compute-resources: must specify limits.cpu.
Deployment
manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: <app name>
name: <app name>
spec:
progressDeadlineSeconds: 60
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: <app name>
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
creationTimestamp: null
labels:
app: <app name>
spec:
containers:
- env:
<end properties>
image: <image reference>
resources:
limits:
cpu: 1000m
imagePullPolicy: Always
name: user-container
ports:
- containerPort: 8191
protocol: TCP
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/jwt
name: jwt
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- name: jwt
secret:
defaultMode: 420
secretName: qc-app-jwt-token
When I describe the deployment’s replicaset I git these:
Name: <app name>-65dbcf47c9
Namespace: <namespace>
Selector: app=<app name>,pod-template-hash=65dbcf47c9
Labels: app=<app name>
pod-template-hash=65dbcf47c9
Annotations: deployment.kubernetes.io/desired-replicas: 1
deployment.kubernetes.io/max-replicas: 2
deployment.kubernetes.io/revision: 1
Controlled By: Deployment/<app name>
Replicas: 0 current / 1 desired
Pods Status: 0 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: app=<app name>
pod-template-hash=65dbcf47c9
Annotations: sidecar.istio.io/inject: true
Containers:
user-container:
Image: <image reference>
Port: 8191/TCP
Host Port: 0/TCP
Limits:
cpu: 1
Environment Variables from:
<configma name> ConfigMap Optional: false
Environment:
<env values>
Mounts:
/etc/jwt from jwt (rw)
Volumes:
jwt:
Type: Secret (a volume populated by a Secret)
SecretName: <secret name>
Optional: false
Conditions:
Type Status Reason
---- ------ ------
ReplicaFailure True FailedCreate
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-9clmx" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-bpkgv" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-l62n2" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-gmgjj" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-55jc7" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-7swww" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-tgw8z" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-5285t" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 18s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-l7wgl" is forbidden: failed quota: compute-resources: must specify limits.cpu
Warning FailedCreate 9s (x3 over 17s) replicaset-controller (combined from similar events): Error creating: pods "<app name>-65dbcf47c9-q5rqf" is forbidden: failed quota: compute-resources: must specify limits.cpu
When using the quotas
requests.cpu the Deployment
works as described in the documentation (Resource Quotas | Kubernetes), if no spec.containers[].resources.requests.cpu are set, the ReplicaSet
fails with a descriptive message (missing requests.cpu)