Chris F
Chris F

Reputation: 16822

How to resolve Kubernetes Deployment warning?

$ kubectl version --short
Client Version: v1.20.2
Server Version: v1.19.6-eks-49a6c0

I have the following Deployment manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: stats-service
  namespace: my-system
  labels:
    app: stats-service
spec:
  selector:
    matchLabels:
      app: stats-service
  template:
    metadata:
      labels:
        app: stats-service
    spec:
      containers:
      - name: stats-service
        image: 0123456789.dkr.ecr.us-east-1.amazonaws.com/stats-service:3.12.1
        resources:
          requests:
            memory: "1024m"
            cpu: "512m"
          limits:
            memory: "2048m"
            cpu: "1024m"
        ports:
        - name: http
          containerPort: 5000
          protocol: TCP
       startupProbe:
          httpGet:
            path: /manage/health
            port: 5000
          failureThreshold: 30
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /manage/health
            port: 5000
          failureThreshold: 3
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /manage/health
            port: 5000
          failureThreshold: 6
          periodSeconds: 10
        env:
        - name: SPRING_PROFILES_ACTIVE
          value: test
        - name: JAVA_OPTS
          value: "my_java_opts"

When I apply it I get the following warning, and the Pod never gets created. What does it mean and how to resolve it? In my case, I'm running and EKS Fargate (only) cluster. Thanks!

$ kubectl describe pod stats-service-797784dfd5-tvh84
...
  Warning  FailedCreatePodSandBox  12s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create containerd task: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:319: getting the final child's pid from pipe caused \"read init-p: connection reset by peer\"": unknown

NOTES:

Upvotes: 2

Views: 4897

Answers (1)

Eduardo Baitello
Eduardo Baitello

Reputation: 11376

You are using the wrong notations for your resources. As per Meaning of memory:

Limits and requests for memory are measured in bytes. You can express memory as a plain integer or as a fixed-point number using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki.

If you want,

  • Requests:
    • 1GB RAM
    • 0.5 vCPU/Core
  • Limits:
    • 2GB RAM
    • 1 vCPU/Core

This should work:

        resources:
          requests:
            memory: "1G"
            cpu: "0.5"
          limits:
            memory: "2G"
            cpu: "1"

The following is equivalent, but using different notations:

        resources:
          requests:
            memory: "1024M"
            cpu: "500m"
          limits:
            memory: "2048M"
            cpu: "1000m"

Notice that the above example uses M for memory, not m.

Upvotes: 3

Related Questions