Roman Petriv
Roman Petriv

Reputation: 11

How to configure different limits and requests for CPU/memory in Cloud Run for GKE pods?

In Cloud Run for GKE I can see only a single parameter to define CPU/memory allocation. And it applies it to both requests and limits. Is it possible to configure CPU/Memory requests and limits separately?

Upvotes: 0

Views: 1116

Answers (1)

ahmet alp balkan
ahmet alp balkan

Reputation: 45196

Yes, you can in fact configure both requests and limits for Cloud Run on GKE services. However, this is not available in the gcloud run deploy CLI (yet).

Instead, you need to write a YAML manifest for a Knative Service (a.k.a. KService) and specify requests/limits just like a Kubernetes app and you can use gcloud alpha run replace command to deploy this manifest (like kubectl apply).

There's an example at https://knative.tips/pod-config/cpu-memory-resources/ I'm pasting here for posterity:

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: hello
spec:
  template:
    spec:
      containers:
      - image: gcr.io/google-samples/hello-app:1.0
        resources:
          requests:
            cpu: 200m
            memory: 512M
          limits:
            cpu: 500m
            memory: 1Gi

Upvotes: 1

Related Questions