0
0
Kubernetesdevops~30 mins

Resource requests and limits in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Resource requests and limits
📖 Scenario: You are managing a Kubernetes cluster where you want to ensure that your application pods have guaranteed CPU and memory resources. This helps the cluster allocate resources efficiently and prevents pods from using too much or too little.
🎯 Goal: You will create a Kubernetes pod configuration YAML file that sets resource requests and limits for CPU and memory. This ensures your pod has the right amount of resources reserved and capped.
📋 What You'll Learn
Create a pod manifest with metadata name myapp-pod
Add a container named myapp-container using the image nginx
Set resource requests for CPU to 100m and memory to 200Mi
Set resource limits for CPU to 500m and memory to 500Mi
Print the final YAML manifest
💡 Why This Matters
🌍 Real World
Setting resource requests and limits is essential in real Kubernetes clusters to ensure fair resource distribution and stable application performance.
💼 Career
DevOps engineers and site reliability engineers often configure resource requests and limits to optimize cluster resource usage and prevent outages.
Progress0 / 4 steps
1
Create the basic pod manifest
Create a YAML manifest for a pod named myapp-pod with one container named myapp-container using the image nginx. Write the YAML starting with apiVersion: v1 and kind: Pod.
Kubernetes
Need a hint?

Start with the basic pod structure and add metadata and container details.

2
Add resource requests
Add resource requests under the container spec. Set cpu to 100m and memory to 200Mi inside resources.requests.
Kubernetes
Need a hint?

Indent resource requests correctly under the container.

3
Add resource limits
Add resource limits under the container spec inside resources. Set cpu to 500m and memory to 500Mi inside resources.limits.
Kubernetes
Need a hint?

Place limits at the same level as requests under resources.

4
Print the final YAML manifest
Print the complete YAML manifest for the pod with resource requests and limits exactly as created.
Kubernetes
Need a hint?

Use a print statement to output the full YAML manifest as a string.