Commonly used commands in Kubernetes
Here are some common commands related to Kubernetes:
Cluster Management:
kubectl cluster-info
: Display information about the Kubernetes cluster.kubectl get nodes
: List all the nodes in the cluster.kubectl describe node <node-name>
: Get detailed information about a specific node.kubectl get namespaces
: List all namespaces in the cluster.kubectl create namespace <namespace-name>
: Create a new namespace.kubectl delete namespace <namespace-name>
: Delete a namespace and all its resources.
Workload Management:
kubectl create deployment <deployment-name> --image=<image-name>
: Create a new deployment using a specified container image.kubectl get deployments
: List all deployments in the cluster.kubectl describe deployment <deployment-name>
: Get detailed information about a specific deployment.kubectl scale deployment <deployment-name> --replicas=<replica-count>
: Scale the number of replicas for a deployment.kubectl delete deployment <deployment-name>
: Delete a deployment and all its associated resources.
Pod Management:
kubectl get pods
: List all pods in the cluster.kubectl describe pod <pod-name>
: Get detailed information about a specific pod.kubectl logs <pod-name>
: View the logs of a specific pod.kubectl exec -it <pod-name> -- <command>
: Execute a command inside a pod.kubectl delete pod <pod-name>
: Delete a pod.
Service Management:
kubectl get services
: List all services in the cluster.kubectl describe service <service-name>
: Get detailed information about a specific service.kubectl expose deployment <deployment-name> --port=<port> --target-port=<target-port> --type=<service-type>
: Expose a deployment as a service.kubectl delete service <service-name>
: Delete a service.
These are just a few examples of commonly used commands in Kubernetes. There are many more commands and options available depending on your specific use cases and requirements.