How can I apply this file to all namespaces:
apiVersion: v1
kind: LimitRange
metadata:
name: resource-limits
spec:
limits:
-
type: Pod
max:
cpu: 1000m
memory: 1Gi
min:
cpu: 500m
memory: 500Mi
By default it gets applied to namespace I am into. I want to make this setting a common one
How can I do that. Make this a global setting.
As per my investigation, this is not possible natively in the manifest file, but here I implemented a trick-script to do so using bash, if you are deploying the manifest using
kubectl, then use this auxiliary script:Maybe you'd say why I'm applying this in a loop and not in one line by adding as many
--namespaceflags as the namespaces we have! Actually, I tried so, but it looks likekubectlcommand does not consider multiple--namespacewhen passed via a variable, like follows: