K8's commands

K8's commands

·

3 min read

  1. kubectl create: Create a Kubernetes resource from a file or from standard input.

  2. kubectl apply: Apply changes to a Kubernetes resource using a configuration file.

  3. kubectl get: Display information about Kubernetes resources, such as pods, services, and deployments.

  4. kubectl describe: Show detailed information about a specific Kubernetes resource.

  5. kubectl delete: Delete a Kubernetes resource, such as a pod or deployment.

  6. kubectl logs: Display the logs of a container running in a pod.

  7. kubectl exec: Execute a command inside a container running in a pod.

  8. kubectl port-forward: Forward network traffic from a local port to a port on a Kubernetes pod.

  9. kubectl scale: Increase or decrease the number of replicas for a deployment.

  10. kubectl rollout: Roll out a new version of a deployment.

  11. kubectl label: Add or remove labels from a Kubernetes resource.

  12. kubectl annotate: Add or remove annotations from a Kubernetes resource.

  13. kubectl top: Display resource usage metrics for Kubernetes resources.

  14. kubectl edit: Edit a Kubernetes resource in real time.

  15. kubectl apply -f: Apply a Kubernetes configuration file.

  16. kubectl create -f: Create a Kubernetes resource from a configuration file.

  17. kubectl rollout history: View the rollout history of a deployment.

  18. kubectl rollout undo: Roll back a deployment to a previous version.

  19. kubectl expose: Expose a Kubernetes deployment as a service.

  20. kubectl attach: Attach to a running container in a pod.

  21. kubectl exec -it: Open an interactive shell inside a container in a pod.

  22. kubectl cp: Copy files to and from a container in a pod.

  23. kubectl logs -f: Follow the logs of a container in real time.

  24. kubectl logs --tail: View the last N lines of a container's logs.

  25. kubectl logs --since: View logs for a specific time.

  26. kubectl logs --container: View logs for a specific container in a pod.

  27. kubectl rollout pause: Pause a deployment rollout.

  28. kubectl rollout resume: Resume a paused deployment rollout.

  29. kubectl rollout status: Check the status of a deployment rollout.

  30. kubectl rollout restart: Restart a deployment rollout.

  31. kubectl create secret: Create a Kubernetes secret.

  32. kubectl get secret: View a Kubernetes secret.

  33. kubectl delete secret: Delete a Kubernetes secret.

  34. kubectl create configmap: Create a Kubernetes config map.

  35. kubectl get configmap: View a Kubernetes config map.

  36. kubectl delete configmap: Delete a Kubernetes config map.

  37. kubectl set image: Update a container image in a deployment.

  38. kubectl rollout history deployment: View the rollout history of a deployment.

  39. kubectl rollout undo deployment: Roll back a deployment to a previous version.

  40. kubectl rollout restart deployment: Restart a deployment rollout.

  41. kubectl apply -k: Apply resources defined in a Kustomization file.

  42. kubectl kustomize: Render a Kustomization file.

  43. kubectl create role: Create a Kubernetes role.

  44. kubectl create rolebinding: Create a Kubernetes role binding.

  45. kubectl create serviceaccount: Create a Kubernetes service account.

  46. kubectl describe serviceaccount: Show details of a Kubernetes service account.

  47. kubectl delete serviceaccount: Delete a Kubernetes service account.

  48. kubectl exec --stdin --tty: Open an interactive shell inside a container in a pod.