Configure minikuke kube-system cpu limit

8/22/2018

For development, I need to reduce cpu usage of minikube.

My goal is to limit cpu usage for each kube-system pods. I tried to modify cpu limits in kube-dns yaml editor from dashboard, but I get an error (probably because it is a system pod).

Is there a way to modify those kube-system .yml files before starting minikube and get a customized kube-system ?

I'm using minikube on windows.

Thank you in advance for your help.

-- Alphapage
kubernetes
minikube

1 Answer

8/23/2018

To achieve your goal, you can try to use limits for namespaces. You may create YAML:

apiVersion: v1
kind: LimitRange
metadata:
  name: cpu-limit-range
spec:
  limits:
  - default:
      cpu: 1
    defaultRequest:
      cpu: 0.5
    type: Container

and add the amount which you need (for example 0.003), then apply it to kube-systemnamespace.

kubectl create -f LimitRangeCPU.yaml --namespace=kube-system

In this case, if pods have no pre-configured resource limits, LimitRangeCPU will be used as default for all pods in namespace kube-system, where all system pods are located.

Update

You can export your existing configs:

kubectl get -o=yaml -n kube-system --export  deployment.extensions/kube-dns > kube-dns.yaml

than update resource usage in section:

resources:
   limits:
      memory: 170Mi
   requests:
      cpu: 100m
      memory: 70Mi

and apply changes:

kubectl apply -f ./kube-dns --namespace=kube-system

It should help to update existing pods.

-- Nick Rak
Source: StackOverflow