I created Limits for the pods on kubernetes api server like this
apiVersion: v1
kind: LimitRange
metadata:
name: limits
spec:
limits:
- default:
cpu: 100m
memory: 512Mi
max:
memory: 1024Mi
type: pod
If I understand correctly,kubernetes would reject pod if the pod is exceeding user defined limits resource when the pod is created. so, I try to create a new pod which passed resource limits, then I try to consume resources reaching to the maximum limits resource, but it doesn't have any affected to the pod. Are the LimitsRanger and ResourceQuota plugin cover on this case or not if not how can I limit resource pods after it's already created?
LimitRange is part of admission control; as you say, it has no effect once a Pod is running. To limit runtime resource consumption, use the Resources field in the Container.
DavidO answer is correct, so I just want to explain a solution which solve this problem to others people whose facing same the problem with me.
you can limit running pod by adding the resources fields like this
inside the array of container attributes in yaml or json file ,then I just create the rc and pods with file by
that's all credit: DavidO