Welcome, DevOps enthusiasts! Kubernetes is the backbone of modern cloud-native applications, and mastering its commands is a must-have skill for developers and DevOps engineers alike. In this article, weβll explore essential Kubernetes commands, categorized for better understanding and usability.
π£ List of Kubernetes Commands π£
β‘οΈ ReplicaSets Management
kubectl create -f : Create a ReplicaSet.
kubectl get replicasets: List all ReplicaSets.
kubectl describe replicaset : Describe a specific ReplicaSet.
kubectl scale replicaset --replicas=: Scale a ReplicaSet.
β‘οΈ Service Management
kubectl create service --tcp=: Create a service.
kubectl get services: List all services.
kubectl expose deployment --port=: Expose a deployment as a service.
kubectl describe service : Describe a specific service.
kubectl delete service : Delete a service.
kubectl get endpoints : Get information about a service.
β‘οΈ ConfigMaps and Secrets
kubectl create configmap --from-file=: Create a ConfigMap from a file.
kubectl create secret --from-literal==: Create a secret.
kubectl get configmaps: List all ConfigMaps.
kubectl get secrets: List all secrets.
kubectl describe configmap : Describe a specific ConfigMap.
kubectl describe secret : Describe a specific secret.
kubectl delete secret : Delete a specific secret.
kubectl delete configmap : Delete a specific ConfigMap.
β‘οΈ Networking
kubectl port-forward :: Port forward to a pod.
kubectl expose deployment --type=NodePort --port=: Expose a deployment as a NodePort service.
kubectl create ingress --rule=/=:: Create an Ingress resource.
kubectl describe ingress : Get information about an Ingress.
kubectl get ingress -o jsonpath='{.spec.rules[0].host}': Retrieve the host value from the first rule of the specified Ingress resource.
β‘οΈ Storage
kubectl create -f : Create a PersistentVolume.
kubectl get pv: List all PersistentVolumes.
kubectl describe pv : Describe a specific PersistentVolume.
kubectl create -f : Create a PersistentVolumeClaim.
kubectl get pvc: List all PersistentVolumeClaims.
kubectl describe pvc : Describe a specific PersistentVolumeClaim.
β‘οΈ StatefulSets
kubectl create -f : Create a StatefulSet.
kubectl get statefulsets: List all StatefulSets.
kubectl describe statefulset : Describe a specific StatefulSet.
kubectl scale statefulset --replicas=: Scale a StatefulSet.
β‘οΈ Monitoring and Troubleshooting
kubectl get events: Check cluster events.
kubectl get componentstatuses: Get cluster component statuses.
kubectl top nodes: Get resource utilization of nodes.
kubectl top pods: Get resource utilization of pods.
kubectl debug -it --image=: Enable container shell access debugging.
π’ Conclusion
With these commands at your fingertips, youβre ready to take your Kubernetes skills to the next level. From managing ReplicaSets and services to networking, storage, and troubleshooting, this cheat sheet is your quick guide to navigating Kubernetes like a pro.
Let me know in the comments which command you use the most, and share this guide with your team! π
Top comments (0)