Home

LAB155

CKA Practice Task - ResourceQuota and Deployment

Objective

Create a namespace named limited and configure it so that:

Step 1 - Create Namespace

    kubectl create namespace limited
    

Step 2 - Create ResourceQuota

Create a file named quota.yaml.

    apiVersion: v1
    kind: ResourceQuota
    metadata:
      name: limited-quota
      namespace: limited
    spec:
      hard:
        pods: "5"
        requests.memory: 1Gi
    

Apply the configuration:

    kubectl apply -f quota.yaml
    
Exam Tip: If a namespace has a memory request quota, Pods must have memory requests defined or they will be rejected.

Step 3 - Create Deployment

Create a file named deploy.yaml.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: lab157deploy
      namespace: limited
    spec:
      replicas: 3
      selector:
        matchLabels:
          app: lab157deploy
      template:
        metadata:
          labels:
            app: lab157deploy
        spec:
          containers:
          - name: nginx
            image: nginx
            resources:
              requests:
                memory: "32Mi"
    

Apply the Deployment:

    kubectl apply -f deploy.yaml
    

Step 4 - Verify Deployment

    kubectl get deploy -n limited
    
    kubectl get pods -n limited
    

You should see three running Pods.

Step 5 - Verify Memory Requests

    kubectl describe pod -n limited POD_NAME
    

Look for:

    Requests:
      memory: 32Mi
    

Step 6 - Verify ResourceQuota Usage

    kubectl describe resourcequota limited-quota -n limited
    

Expected output:

    Resource            Used     Hard
    --------            ----     ----
    pods                3        5
    requests.memory     96Mi     1Gi
    

What This Task Tests on the CKA

Memory Calculation:
3 Pods × 32Mi = 96Mi total requested memory.
96Mi is less than the namespace quota of 1Gi, so the Deployment is allowed.

Personal Notes

Add your own troubleshooting notes and observations here: