pod.containers.spec.resources doesn't work (limits and requests) Kubernetes

6/20/2018

I'm trying to use resources limits and requests in the definition of my pod but It's like if the scheduler doesn't want to apply my specifications :

    kind: Pod
    apiVersion: v1
    metadata:
      name: pod-lab5
      namespace: limit-namespace
      labels:
        app: stress
    spec:
      containers:
        - name: resources-limit
          image: dkuffner/docker-stress
          command: ["stress"]
          args: ["--vm", "1", "--vm-bytes", "50M", "--vm-hang", "1"]
          resources:
            requests:
              memory: "60Mi"
              cpu: "70m"
            limits:
              memory: "65Mi"
              cpu: "75m"
            requests:
              ephemeral-storage: "2Gi"
            limits:
              ephemeral-storage: "4Gi"

enter image description here enter image description here And when i use limit range it takes the default spec :

apiVersion: v1
kind: LimitRange
metadata:
  name: mylimits
  namespace: limit-namespace
spec:
  limits:
  - max:
      cpu: 100m
      memory: 100Mi
    min:
      cpu: 40m
      memory: 20Mi
    type: Pod
  - default:
      cpu: 80m
      memory: 70Mi
    defaultRequest:
      cpu: 60m
      memory: 50Mi
    max:
      cpu: 100m
      memory: 100Mi
    min:
      cpu: 40m
      memory: 20Mi
    type: Container

enter image description here

enter image description here

Anyone can help me ? thanks :)

-- Yummel
kubeadm
kubernetes
resources

1 Answer

6/20/2018

I think it's just duplication issues of same parameters.

  resources:
    requests:
      memory: "60Mi"
      cpu: "70m"
    limits:
      memory: "65Mi"
      cpu: "75m"
    requests:
      ephemeral-storage: "2Gi"
    limits:
      ephemeral-storage: "4Gi"

modify as follows, and then test again.

  resources:
    requests:
      memory: "60Mi"
      cpu: "70m"
      ephemeral-storage: "2Gi"
    limits:
      memory: "65Mi"
      cpu: "75m"
      ephemeral-storage: "4Gi"
-- Daein Park
Source: StackOverflow