Sunday, May 13, 2018

Kubernetes - Resource allocation

We all know that pod contain containers that run applications. It is required to allocate resources
to the container which they can use. Here is an example of allocating resources to the containers
in the pod

[root@manja17-I13330 kubenetes-config]# cat basic-single-container-pod.yml
apiVersion: v1
kind: Pod
metadata:
 name: testing-service
spec:
 containers:
   - name: test-ser
     image: docker.io/jagadesh1982/testing-service
     ports:
     - containerPort: 9876
     resources:
       limits:
         memory: "64Mi"
         cpu: "500m"

Once we create the pod using the kubectl command and describe the pod we can see the limits defined as,

Limits:
     cpu:   500m
     memory:  64Mi
Requests:
     cpu:      500m
     memory:     64Mi

So we have the limits defined as requested and allocated.

No comments :

Post a Comment