Kubernetes cheat book part-12 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

As many of you working with the Kubernetes cluster for deploying your applications and other supporting components. There are a lot of commands which you need to learn or remember when you are managing the cluster.

Here I’m trying to provide the list of the commands which I’m using to manage the cluster. So let’s go through that,

List namespace

kubectl get namespace

The above command will list all the namespaces which are available in the Kubernetes cluster.

List pods

kubectl get pods

The above command will list all the pods in the default namespace 

List the pods on a specific namespace

Kubectl get pods —namespace test

Here test the namespace name, and it will list all the pods which are running in the test namespace

List the nodes

kubectl get nodes

This will list all the worker nodes joined with cluster

Get detailed information about nodes

kubectl get nodes -o wide

The above commands give the node IP hostname etc

Get into the running pod

To get into the pod we need the pod name first, got get pod name first

kubectl get pod

Copy the pod name

Kubectl exec -it <podname> bash

Replace the pod name with the expected name

Get the pod logs

First get the pod name, once you got name

kubectl logs -f <podname>

This will give the details of the running log of the pod.

Get more detail about the pod

More information about the pod is required when you need to troubleshoot or when you need to get more information about the pod.

Kubectl describe pod <podname>

Get more details about the node

kubectl describes node <nodename>

© 2021, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply