β˜€οΈ
Dev7Days
  • πŸ˜„Welcome
  • Local Setup
    • βš™οΈSetup Terminal
    • βš™οΈSetup IDE
    • βš™οΈSetup Neovim
  • Rust
    • πŸ¦€Cargo
  • Java
    • πŸƒSpring Boot
      • Spring Boot Annotaion
      • Spring Boot Learning
    • πŸƒJDK vs JRE vs JVM
    • πŸƒWhat is JDBC ?
    • πŸƒWhat is Data Source in Java ?
    • πŸƒCheck vs Unchecked Exception
    • πŸƒWhat is Servlet in Java ?
    • πŸƒFilter vs Interceptor
    • πŸƒMockito
    • πŸƒMaven CLI
    • πŸƒMaven Archetype
  • Go
    • πŸ”ΉGo Routine and Channel
    • πŸ”ΉGo CLI
  • Ruby and Rails
    • ♦️Ruby Syntax
    • ♦️Rails Framework
    • ♦️Rails Structure
  • Fundamental
    • πŸ“šGit Command
    • πŸ“šInterpreter vs Compiler
    • πŸ“šDTO vs DAO
    • πŸ“šHttp Status
    • πŸ“šWhat is Batch Process ?
    • πŸ“šHttps
    • πŸ“šLocal Storage vs Session Storage vs Cookies
    • πŸ“šAuthentication & Authorization
    • πŸ“šDatabase Index
    • πŸ“šWhat is GRPC ?
    • πŸ“šWhat is Microservice ?
  • Database
    • πŸ—ƒοΈWhat is Transaction ?
    • πŸ—ƒοΈACID
  • Postgres
    • 🐘SELECT
    • 🐘Column Alias
    • 🐘Order By
    • 🐘SELECT DISTINCT
  • Elastic Search
    • πŸ”What is Elastic Search ?
    • πŸ”Node and Cluster
  • Kubernetes
    • ☸️What is Kubernetes ?
    • ☸️Kubernetes Architecture
      • Node
      • ETCD
      • Kube API Server
      • Controller Manager
      • Kube Scheduler
      • Kubelet
      • Kube Proxy
  • ☸️Pod
  • ☸️ReplicaSet
  • ☸️Deployment
  • ☸️Service
  • ☸️Config Map
  • ☸️Namespaces
  • ☸️Kube Apply Command
  • ☸️Scheduling
    • Manual Scheduling
    • Labels and Selectors
    • Taints and Tolerations
    • Node Selector
    • Node Affinity
    • Resource Requirements and Limits
    • DaemonSets
    • Static Pods
    • MultipleSchedulers
  • ☸️Monitoring
  • AWS
    • πŸ”ΈHow can users access AWS ?
    • πŸ”ΈIAM
    • πŸ”ΈEC2
      • User Data
      • Instance Types
      • Security Group
      • Purchasing Options
      • Placement Groups
      • Elastic Network Interface (ENI)
      • EC2 Hibernate
      • EC2 Storage
    • πŸ”ΈELB & ASG
      • Health Checks
      • Target Group
      • ELB Types
      • Sticky Sessions
      • Cross Zone Load Balancing
      • Load Balancer - SSL and SNI
      • Deregistration Delay
      • ASG
    • πŸ”ΈRDS & Aurora DB
      • RDS
        • Storage Auto Scaling
        • Read Replica
        • Multi AZ
        • RDS Custom
        • Backup
        • RDS Proxy
      • AWS Aurora
        • Read Replica
        • Endpoint and Auto Scaling
        • Aurora Serverless
        • Global Database
        • Machine Learning
        • Backup
        • Database Cloning
      • RDS & Aurora Restore options
      • RDS & Aurora Security
    • πŸ”ΈElastic Cache
    • πŸ”ΈRoute 53
      • Records
      • Hosted Zones
      • Health Check
      • Routing Policies
  • Backend Security
    • 🎩SQL Injection
    • 🎩Cross site script (XSS)
    • 🎩Cross site request forgery (CSRF)
    • 🎩Man in the Middle (MITM)
    • 🎩Insecure Direct Object Reference (IDOR)
    • 🎩Distributed denial of service (DDOS)
  • Medium
    • πŸ‘¨β€πŸ’»Gamer to Coder
    • 🐳Docker
      • Docker #1
      • Docker #2
    • πŸ’ŠDI and IOC
    • ☸️Kubernetes
  • Book
    • πŸ“šSystem Design Interview - An Insider's Guide (Volume 1
Powered by GitBook
On this page
  1. Scheduling

Resource Requirements and Limits

Describe about Resource Requirements and Limits

When creating the Pod, it will consume two types of resources on the Node.

  1. CPU

  2. Memory

If every node lacks sufficient CPU or memory to create a new Pod, an error indicating Insufficient CPUwill occur and The Pod is in a pending state.

Resource Request

Resource Request is define to specify amount of CPU and Memory that required for a Pod when creating one. So when the scheduler tries to place the pod on Node, It uses these numbers to identify a node which has sufficient amount of resource available.

Resource Limit

Resource Limit is a set of limit for the resource usage on the pod. In the case that the Pod consume resource exceed limit for CPU It can't over limit but forr Memory It will error Out of memory (OOM) and terminate Pod .

Noted:

By default the Resource Request and Resource Limit does not specify so the pod can consume resource as much as it require .

# Pod Template
apiVersion: v1
kind: Pod
metadata:
  name: simple-webapp-color
  labels:
    name: simple-webapp-color
spec:
  containers:
  - name: simple-webapp-color
    image: simple-webapp-color
    ports:
      - containerPort: 8080

    resources:
    # Resource Request
      requests:
        memory: "1Gi"
        cpu: 1
    # Resource Limit
      limits:
        memory: "2Gi"
        cpu: 2             
    

Resource CPU Unit

0.1 = 100 M (M = Mili) (Minimum required for CPU is 1 M)

1 count = 1 vCPU (AWS) | 1 GCP Core | 1 Azure Core | 1 Hyperthread

Resource Memory Unit

1 G (Gigabyte) = 1,000,000,000 bytes

1 M (Megabyte) = 1,000,000 bytes

1 K (Kilobyte) = 1,000 bytes

1 Gi (Gibibyte) = 1,073,741,824 bytes

1 Mi (Mebibyte) = 1,048,576 bytes

1 K i(Kibibyte) = 1,024 bytes

Behavior CPU and Memory

Case 1 This case If we Pod A consume all resource of Node Pod B is not able to create

Case 2

If we specify only limit , Kubernetes will set the resource request automatically the same as limit

Case 3

If we specify both request and limit from the picture If the resource request for Pod A is 2 and for Pod B is 1, and both have a limit set to 3, Pod B will retain the resources as it currently utilizes only 1. However, if Pod A intends to consume additional resources, it cannot utilize the remaining resources from Pod B due to the set limit of 3. Case 4 (Best Practice)

In this scenario, setting only the request ensures that the Pod can be created with a guaranteed amount of resources. Subsequently, if the Pod requires additional resources, it can continue to consume them, as no explicit limit has been set. (If the memory resources in Pod B are insufficient, it necessitates terminating Pod A.)

PreviousNode AffinityNextDaemonSets

Last updated 1 year ago

☸️
Drawing