Basic | Top 10 Kubernetes commands

Get started with Kubernetes with this guide to the top 10 commands.

Ink Insight 🧘🏼
DevOps Dudes
2 min readFeb 6, 2023

--

Photo by insung yoon on Unsplash

Ready to get your Kubernetes game on? These are the fundamental commands you should know if you’re working with the platform. Think of them as your daily training exercises to become a pro!

  1. kubectl get — Retrieve information about resources in your cluster, such as pods, services, and nodes.
    Example: kubectl get pods
  2. kubectl describe — Get detailed information about a specific resource, including its current state, events, and metadata.
    Example: kubectl describe pod <pod-name>
  3. kubectl apply — Create or update resources in your cluster using a YAML or JSON file.
    Example: kubectl apply -f deployment.yaml
  4. kubectl create — Create a new resource in your cluster.
    Example: kubectl create deployment nginx — image=nginx
  5. kubectl delete — Delete a resource from your cluster.
    Example: kubectl delete pod <pod-name>
  6. kubectl scale — Scale the number of replicas for a deployment or replica set.
    Example: kubectl scale deployment <deployment-name> — replicas=3
  7. kubectl exec — Run a command in a running container.
    Example: kubectl exec <pod-name> — ls /
  8. kubectl port-forward — Forward traffic from your local machine to a pod in your cluster.
    Example: kubectl port-forward <pod-name> 8080:80
  9. kubectl logs — Retrieve the logs generated by a container in a pod.
    Example: kubectl logs <pod-name>
  10. kubectl rollout — Manage rolling updates for deployment.
    Example: kubectl rollout restart deployment <deployment-name>

Note: Replace the placeholder values in angle brackets (e.g. <pod-name>, <deployment-name>) with actual values for your environment.

Ready for advanced k8s commands?

Thanks for reading! I appreciate your support 👏 and engagement 🚙 in my stories. I’m always looking for ways to improve, so please feel free to leave a comment or share your thoughts.

--

--

Ink Insight 🧘🏼
DevOps Dudes

Discover the intersection of DevOps, InfoSec, and mindfulness with Ink Insight. Follow for valuable insights! ✍︎ 👨‍💻 🧘🏼