Tuesday, August 8, 2023

Adding limits for resources utilization


Adding limits for resources utilization

Create a pod named httpd-pod and a container under it named as httpd-container, use httpd image with latest tag only and remember to mention tag i.e httpd:latest and set the following limits:

Requests: Memory: 15Mi, CPU: 100m

Limits: Memory: 20Mi, CPU: 100m


This can be achieved by creating a YAML file for the pod and container configuration. Here's the YAML content to create the httpd-pod with the specified resource limits:


YAML File Configuration:-

apiVersion: v1

kind: Pod

metadata:

  name: httpd-pod

spec:

  containers:

  - name: httpd-container

    image: httpd:latest

    resources:

      requests:

        memory: "15Mi"

        cpu: "100m"

      limits:

        memory: "20Mi"

        cpu: "100m"


Apply the YAML file to create the pod with the specified resource limits:

# kubectl apply -f httpd-pod.yaml


To verify that the pod has been created and the resource limits are set, you can use the following command:

# kubectl describe pod httpd-pod


This will display detailed information about the pod, including the resource limits that you've set.


No comments:

Post a Comment

Troubleshoot issue with Pods - Part 2

  Troubleshoot issue with Pods - Part 2 To verify if there are any port conflicts between the containers and ensure that the container ports...