---
# System prepended metadata

title: Kubectl Commands

---

1. Kubectl
  
 The "kubectl get" command is used to list resources in a cluster. For example, to list all the pods in a namespace, you can run the following command: 

kubectl get pods -n <namespace-name>
    
2. kubectl describe    
    
 The "kubectl describe" command is used to display detailed information about a specific resource. For example, to display detailed information about a pod, you can run the following command:
    
kubectl describe pod <pod-name> -n <namespace-name>
    
3. kubectl apply
    
 The "kubectl apply" command is used to apply changes to resources in a cluster. For example, to apply a configuration file to create a deployment, you can run the following command:
    
kubectl apply -f <config-file-name>.yaml
    
4. kubectl delete

 The "kubectl delete" command is used to delete resources from a cluster. For example, to delete a deployment, you can run the following command:
    
kubectl delete deployment <deployment-name> -n <namespace-name>
    
5. kubectl create
    
 The "kubectl create" command is used to create resources in a cluster. For example, to create a new namespace, you can run the following command:
    
kubectl create namespace <namespace-name>
    
6. kubectl scale

 The "kubectl scale" command is used to scale the number of replicas in a deployment. For example, to scale a deployment to 5 replicas, you can run the following command:
    
kubectl scale deployment <deployment-name> --replicas=5 -n <namespace-name>
    
7. kubectl edit
    
 The "kubectl edit" command is used to edit resources in a cluster. For example, to edit a deployment, you can run the following command:
    
kubectl edit deployment <deployment-name> -n <namespace-name>
    
8. kubectl rollout
    
 The "kubectl rollout" command is used to manage the rollout of a deployment. For example, to rollback a deployment to a previous version, you can run the following command:
    
kubectl rollout undo deployment <deployment-name> -n <namespace-name>
    
9. kubectl exec
    
 The "kubectl exec" command is used to execute a command in a container. For example, to execute a command in a pod, you can run the following command:

kubectl exec <pod-name> -n <namespace-name> -- <command>
    
10. kubectl logs
    
 The "kubectl logs" command is used to retrieve the logs of a pod in the Kubernetes cluster. For example, to retrieve the logs of a pod, you can use the following command:
    
kubectl logs <pod-name>
        
    