Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. alias k='kubectl' # The kubectl command
  2. alias kca='kubectl --all-namespaces' # The kubectl command targeting all namespaces
  3. alias kaf='kubectl apply -f' # Apply a YML file
  4. alias keti='kubectl exec -ti' # Drop into an interactive terminal on a container
  5.  
  6. # Manage configuration quickly to switch contexts between local, dev and staging
  7. alias kcuc='kubectl config use-context' # Set the current-context in a kubeconfig file
  8. alias kcsc='kubectl config set-context' # Set a context entry in kubeconfig
  9. alias kcdc='kubectl config delete-context' # Delete the specified context from the kubeconfig
  10. alias kccc='kubectl config current-context' # Display the current-context
  11.  
  12. # General aliases
  13. alias kdel='kubectl delete' # Delete resources by filenames, stdin, resources and names, or by resources and label selector
  14. alias kdelf='kubectl delete -f' # Delete a pod using the type and name specified in -f argument
  15.  
  16. # Pod management
  17. alias kgp='kubectl get pods' # List all pods in ps output format
  18. alias kgpw='kgp --watch' # After listing/getting the requested object, watch for changes
  19. alias kgpwide='kgp -o wide' # Output in plain-text format with any additional information. For pods, the node name is included
  20. alias kep='kubectl edit pods' # Edit pods from the default editor
  21. alias kdp='kubectl describe pods' # Describe all pods
  22. alias kdelp='kubectl delete pods' # Delete all pods matching passed arguments
  23. alias kgpl='kgp -l' # Get pod by label. Example: kgpl "app=myapp" -n myns
  24.  
  25. # Service management
  26. alias kgs='kubectl get svc' # List all services in ps output format
  27. alias kgsw='kgs --watch' # After listing all services, watch for changes
  28. alias kgswide='kgs -o wide' # After listing all services, output in plain-text format with any additional information
  29. alias kes='kubectl edit svc' # Edit services(svc) from the default editor
  30. alias kds='kubectl describe svc' # Describe all services in detail
  31. alias kdels='kubectl delete svc' # Delete all services matching passed argument
  32.  
  33. # Ingress management
  34. alias kgi='kubectl get ingress' # List ingress resources in ps output format
  35. alias kei='kubectl edit ingress' # Edit ingress resource from the default editor
  36. alias kdi='kubectl describe ingress' # Describe ingress resource in detail
  37. alias kdeli='kubectl delete ingress' # Delete ingress resources matching passed argument
  38.  
  39. # Namespace management
  40. alias kgns='kubectl get namespaces' # List the current namespaces in a cluster
  41. alias kcn='kubectl config set-context --current' # Change current namespace
  42. alias kens='kubectl edit namespace' # Edit namespace resource from the default editor
  43. alias kdns='kubectl describe namespace' # Describe namespace resource in detail
  44. alias kdelns='kubectl delete namespace' # Delete the namespace. WARNING! This deletes everything in the namespace
  45.  
  46. # ConfigMap management
  47. alias kgcm='kubectl get configmaps' # List the configmaps in ps output format
  48. alias kecm='kubectl edit configmap' # Edit configmap resource from the default editor
  49. alias kdcm='kubectl describe configmap' # Describe configmap resource in detail
  50. alias kdelcm='kubectl delete configmap' # Delete the configmap
  51.  
  52. # Secret management
  53. alias kgsec='kubectl get secret' # Get secret for decoding
  54. alias kdsec='kubectl describe secret' # Describe secret resource in detail
  55. alias kdelsec='kubectl delete secret' # Delete the secret
  56.  
  57. # Deployment management
  58. alias kgd='kubectl get deployment' # Get the deployment
  59. alias kgdw='kgd --watch' # After getting the deployment, watch for changes
  60. alias kgdwide='kgd -o wide' # After getting the deployment, output in plain-text format with any additional information
  61. alias ked='kubectl edit deployment' # Edit deployment resource from the default editor
  62. alias kdd='kubectl describe deployment' # Describe deployment resource in detail
  63. alias kdeld='kubectl delete deployment' # Delete the deployment
  64. alias ksd='kubectl scale deployment' # Scale a deployment
  65. alias krsd='kubectl rollout status deployment' # Check the rollout status of a deployment
  66. alias kres='kubectl set env' # Recreate all pods in deployment with zero-downtime
  67.  
  68. # Rollout management
  69. alias kgrs='kubectl get rs' # To see the ReplicaSet rs created by the deployment
  70. alias krh='kubectl rollout history' # Check the revisions of this deployment
  71. alias kru='kubectl rollout undo' # Rollback to the previous revision
  72.  
  73. # Port forwarding
  74. alias kpf='kubectl port-forward' # Forward one or more local ports to a pod
  75.  
  76. # Tools for accessing all information
  77. alias kga='kubectl get all' # List all resources in ps format
  78. alias kgaa='kubectl get all --all-namespaces' # List the requested object(s) across all namespaces
  79.  
  80. # Logs
  81. alias kl='kubectl logs' # Print the logs for a container or resource
  82. alias klf='kubectl logs -f' # Stream the logs for a container or resource (follow)
  83.  
  84. # File copy
  85. alias kcp='kubectl cp' # Copy files and directories to and from containers
  86.  
  87. # Node management
  88. alias kgno='kubectl get nodes' # List the nodes in ps output format
  89. alias keno='kubectl edit node' # Edit nodes resource from the default editor
  90. alias kdno='kubectl describe node' # Describe node resource in detail
  91. alias kdelno='kubectl delete node' # Delete the node
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement