Set Limits for Resources in Kubernetes

Hi @Inderpreet/@kodekloud-support3,

Can you please help to let me know what is wrong in this task.

You put the name in the deployment, not in the pod. I guess the task asked to create a pod and you created it with a deployment. So the pods name has a hash appended to http-pod and hence the task failed

2 Likes

Noted!

Got the point… Thanks for the clarification :slight_smile:

1 Like

I have a question regarding the kubernetes resource requirements. I am asked to set requests & limits on a pod with following requirements:

  1. resource requests: memory: 15Mi , cpu: 1
  2. limit requests: memory: 20Mi, cpu: 2
  3. image: httpd:latest
  4. pod name: httpd-pod
  5. container name: httpd-container

I have the below code as:

apiVersion: v1
kind: Pod
metadata:
labels:
run: httpd-pod
name: httpd-pod
spec:
containers:

  • image: httpd:latest
    name: httpd-container
    resources:
    requests:
    memory: β€œ15Mi”
    cpu: β€œ1000m”
    limits:
    memory: β€œ20Mi”
    cpu: β€œ2000m”
    restartPolicy: Always

But I always get error saying this:

Error: failed to create containerd task: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: process_linux.go:458: setting cgroup config for procHooks process caused: failed to write β€œ200000”: write /sys/fs/cgroup/cpu,cpuacct/kubelet/kubepods/burstable/pode3b03754-3174-489c-bce2-7e24f4129a87/httpd-pod/cpu.cfs_quota_us: invalid argument: unknown

Why does this set 200000 as cpu ? I am not sure how to resolve this issue

3 Likes

I am also facing the same issue, any luck on it?

Hello, @rashed192
Our KKE team members are investigating this issue.

We have fixed some issues with this lab, please try again to see if it works fine now.

Message: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error setting cgroup config for procHooks process: failed to write β€œ200000”: write /sys/fs/cgroup/cpu,cpuacct/kubelet/kubepods/burstable/pod6faa6ac0-71ff-42e9-9a2f-df90fd24387e/93eb17a9d2b52b4a93d9f3b37361e54be303041e1d6f0293a00b4acd3347ca48/cpu.cfs_quota_us: invalid argument: unknown

i am getting this error message continuously please help me

me too getting this,