Kubernetes POD is the smallest unit of execution and it is used to run the actual workload in the cluster. In this article, we are going to discuss few of the basics commands related to PODs :
1. Create POD:
kubectl run command is basically used to create a single POD as shown below:
# kubectl run nginx1 --image=nginx
Note: Above command creates POD in the default namespace, if you want to create a POD in a specific namespace then additional parameter is required as shown below:
# kubectl run nginx1 --image=nginx -n customer1
Here, customer1 is the namespace which must be created before hand using command : kubectl create namespace customer1
2. Get List of PODs:
Use the below command to get the list of PODs in default namespace:
# kubectl get pods
Use the below command to get list of pods in specific namespace:
# kubectl get pods -n customer1
Use the below command to get list of pods in all namespaces:
# kubectl get pods -A
3. Delete POD:
Use the below command to delete a POD:
# kubectl delete pod nginx1
4. Check POD Logs:
Use the below command to check POD logs:
# kubectl logs pod/<podname>
5. Describe POD:
Use the below command to describe POD:
# kubectl describe pod/<podname>