Command Line Cheat Sheet

List of kubectl commands for configuring and troubleshooting issues pertaining to KUBE+ in-cluster components.
S. No. Command Purpose
1
kubectl get all --all-namespaces
lists resources (pods, services, deployments, etc.) in all namespaces.
2
kubectl get namespace <namespace_name>
Retrieves information about a specific namespace in a Kubernetes cluster.
3
kubectl delete namespace <namespace_name>
Deletes a specific namespace and all the resources contained within it in a Kubernetes cluster.
4
kubectl get pod
List all the pods in the current Kubernetes namespace.
5
kubectl get pods -n=[namespace_name]
lists all the pods in a specific namespace in a Kubernetes cluster. Replace "[namespace_name]" with the actual name of the namespace you want to target. This command displays information about the pods in that namespace
6
kubectl delete pod <pod_name>
Deletes a specific pod in a Kubernetes cluster.
7
kubectl get secrets
Lists all the secrets available in the current Kubernetes namespace.
8
kubectl describe secret <secret_name>
Displays detailed information about a specific secret in a Kubernetes cluster.
9
kubectl delete secret <secret_name>
Deletes a specific secret in a Kubernetes cluster.
10
kubectl apply -f manifest_file.yaml
Applies a configuration to an object by filename or stdin.
11
kubectl logs -f <pod_name>
Prints the logs for a pod and it will continuously stream the logs as new log entries that are generated in real-time. This is useful for monitoring and troubleshooting applications running in Kubernetes pods..
12
kubectl logs -c <container_name> <pod_name>
Prints the logs from a specific container within a pod in a Kubernetes cluster.
13
kubectl logs <pod_name> pod.log
Redirects and saves the logs from a specific pod in a Kubernetes cluster to a file named ‘pod.log’.