0
0
Kubernetesdevops~15 mins

Node selectors for simple scheduling in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Node selectors for simple scheduling
📖 Scenario: You are managing a Kubernetes cluster with different types of nodes. You want to schedule a pod to run only on nodes that have a specific label, such as disktype: ssd. This helps ensure your pod runs on nodes with fast storage.
🎯 Goal: Create a pod manifest that uses a node selector to schedule the pod only on nodes labeled with disktype: ssd.
📋 What You'll Learn
Create a pod manifest with metadata name fast-storage-pod
Add a container named app-container running the image nginx
Add a nodeSelector field to schedule the pod on nodes with label disktype: ssd
Print the final pod manifest YAML
💡 Why This Matters
🌍 Real World
Node selectors are used in Kubernetes to ensure pods run on nodes with specific hardware or software characteristics, like SSD storage or GPU support.
💼 Career
Understanding node selectors is important for Kubernetes administrators and DevOps engineers to optimize workload placement and resource usage.
Progress0 / 4 steps
1
Create the basic pod manifest
Create a YAML manifest for a pod named fast-storage-pod with a container named app-container running the image nginx. Do not add node selectors yet.
Kubernetes
Need a hint?

Start with the basic pod YAML structure. Use apiVersion: v1 and kind: Pod. Add metadata with the pod name and a container spec.

2
Add the node selector
Add a nodeSelector field under spec with the key disktype and value ssd to schedule the pod on nodes labeled disktype: ssd.
Kubernetes
Need a hint?

Under spec, add nodeSelector: and then the label key and value as a map.

3
Verify the pod manifest structure
Check that the pod manifest includes nodeSelector with disktype: ssd and the container named app-container with image nginx.
Kubernetes
Need a hint?

Make sure the nodeSelector and container details are exactly as specified.

4
Print the final pod manifest
Print the complete pod manifest YAML to display the pod configuration with the node selector.
Kubernetes
Need a hint?

Store the YAML as a string variable and print it exactly.