Skip to main content

Command Palette

Search for a command to run...

Kubernetes: Node and Pod Management on AWS EKS using kubectl

Updated
3 min read

Project Difficulty:

Project Goal: This project demonstrates how to manage Kubernetes nodes and workloads within an EKS cluster using the command-line. It focuses on practical operations such as inspecting node status, managing pods and interacting with containers running across the cluster. In this project I highlight how kubectl serves as a powerful tool for controlling and maintaining the availability and performance of applications deployed on EKS.

I have this k8 cluster running on AWS from my last project CI/CD: GitHub Actions Pipeline for Automated AWS Deployment

Lets dive in

I need to know what the deployment resources are.

kubectl get deployments gives me a quick snapshot of all Deployment resources in the namespace and their current state. In simple terms, the Deployment file is the (scheduler-deployment.yml) configuration file that defines my desired state and Kubernetes continuously works to ensure the cluster matches that state (creating, updating, or replacing pods as needed).

Currently I have 2 pods running in this node.

kubectl get pods gives me a snapshot of all the pods running in the node. My container currently lives in this pods

I can modify the deployment configuration directly in the cluster. Assume I want to Scale-up (add more pods) or Scale-down (reduce pods) when there's a spike in traffic and current replicas can’t handle the workload efficiently—or when it's the opposite and wasting resources by running too many respectively. I could also access container image (updating versions), pass in environment variables, modify resource limits (CPU/memory) and more

The command to run will be:

kubectl edit deployment scheduler-deployment — opens the configuration of the specified Deployment in the default editor,

press i to insert/edit. I will scale up the replicas (no of pods) to 8

Then press colon : with wq (write-quit) and enter to save the edit

There will now be 8 pods running in the nodes on this cluster using kubectl get pods I can confirm this.

I will use kubectl get svc to lists all Kubernetes Services in the current namespace, showing how the applications are exposed and accessed. Next, eksctl get cluster to see what clusters are running on my AWS EKS

Clearly this external ip: ab139bae86e4947079ca92c99a957565-1770438996.us-east-1.elb.amazonaws.com and this cluster: node-app-prod-us-east-us-east-1

There's an endless list of things I can do but I will stop here .

If I want to tear down everything, simply kubectl delete deployment scheduler-deployment-: The deployment resource is deleted, all pods managed by that deployment are terminated, associated ReplicaSets are also cleaned up

I hope you enjoyed this