source: kubernetes.io

🧠 What is Scheduling in Kubernetes?

Kubernetes scheduling is how the system decides which node should run a given Pod.

 

The Kube-scheduler is the component that assigns Pods to Nodes.
When you create a Pod, it starts in a "Pending" state. The scheduler looks at:

  • The Pod’s requirements (like CPU, memory, labels)
  • The cluster's current state
  • The available nodes

Then it picks the best node to run the Pod.

[ Pod Created ][ Kube-scheduler ]    # Scheduling cycle
      ↓
[ Filter Nodes → Score Nodes ][ Select Best Node ][ Bind Pod to Node ]  # Binding cycle
      ↓
[ kubelet runs Pod ]

 


🏷️ What Are Labels?

In Kubernetes, labeling is a way to tag objects (like Pods, Nodes, Services, etc.) with key-value pairs.

Labels are super useful for organizing, selecting, and managing resources.

 

Labels are arbitrary metadata you attach to objects.
They don’t affect behavior directly, but they help identify and group objects for things like:

  • Scheduling
  • Networking
  • Monitoring
  • Deployments

🧱 Example

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
    tier: frontend
    version: v1

 

🔍 Label Selector

You can use label selectors to filter objects based on labels.

 

1. Equality-based

selector:
  matchLabels:
    app: myapp
    version: v1

 

2. Set-based

selector:
  matchExpressions:
    - key: tier
      operator: In
      values:
        - frontend
        - backend

'CS > Kubernetes' 카테고리의 다른 글

[Kubernetes] Scheduling(2)  (0) 2025.04.04
[Kubernetes] Service  (1) 2025.03.28
[Kubernetes] Replicaset & Deployment  (1) 2025.03.27
[Kubernetes] YAML  (1) 2025.03.27
[Kubernetes] Kubernetes concepts  (1) 2025.03.27