Kubernetes can feel overwhelming at first, but kubectl makes interacting with your cluster simple and powerful. In this post, we’ll explore imperative commands in Kubernetes—hands-on instructions you run directly with kubectl to create, update, and manage resources.
Fundamentals of Kubernetes
Cluster – A set of machines (nodes) that run containerized applications managed by Kubernetes.
Node – A worker machine (virtual or physical) where containers are executed.
Pod – The smallest deployable unit in Kubernetes. A Pod represents one or more containers that share networking and storage.
Replica set – Maintains a stable set of replica pods running at any given time. It is often used to guarantee the availability of a specified number of identical pods.
Service – A stable networking abstraction that exposes Pods and enables communication within or outside the cluster.
Deployment – A controller that manages Pods and ensures the desired number of replicas are running.
Get Worker Nodes status
You can refer to my previous tutorial on how to create a eksctl cluter and managed node group.
kubectl get nodes -o wide
Create a Pod
kubectl run my-first-pod --image stacksimplify/kubenginx:1.0.0
In order to access the application externally from the internet, we need to expose the Pod with a NodePort Service.
kubectl expose pod my-first-pod --type=NodePort --port=80 --name=my-first-service
kubectl get svc
Access the application using public IP
Connect to Container in a Pod
kubectl exec -it my-first-pod -- /bin/bash
Clean-Up
kubectl get all
kubectl delete svc my-first-service
kubectl delete pod my-first-pod
kubectl get all
Thank you!! 🙌






Top comments (0)