I've set cpu limits on my Kubernetes pods, but they do not seem to cap cpu usage at all running on Google Container Engine version 1.3.3
Reading https://github.com/kubernetes/kubernetes/tree/master/examples/runtime-constraints this has to be enabled on the kubelet as follows:
kubelet --cpu-cfs-quota=true
However when checking the process when logging into one of the nodes of my cluster it seems the kubelet is missing this flag:
/usr/local/bin/kubelet --api-servers=https://xxx.xxx.xxx.xxx --enable-debugging-handlers=true --cloud-provider=gce --config=/etc/kubernetes/manifests --allow-privileged=True --v=2 --cluster-dns=10.223.240.10 --cluster-domain=cluster.local --configure-cbr0=true --cgroup-root=/ --system-cgroups=/system --runtime-cgroups=/docker-daemon --kubelet-cgroups=/kubelet --node-labels=cloud.google.com/gke-nodepool=default-pool --babysit-daemons=true --eviction-hard=memory.available<100Mi
Is any Googler able to confirm whether its enabled or not and if not tell us why? Now it seems I don't have the choice to use cpu limits whereas as it's enabled I can just leave cpu limit out of my spec if I don't wish to use it.
Google Container Engine does not support CPU Quota by default. If you'd like to use CPU quota you can switch to using GCI Node image - https://cloud.google.com/container-engine/docs/gci. GCI has support for CPU quota and Container Engine would automatically start supporting CPU limits
on containers.
That flag's default value is true :)
So yes, it is enabled in Container Engine.
edit: I was wrong - the flag is enabled, but the default operating system used by GKE doesn't support it. Vishnu Kannan's answer is correct!