Kubernetes - Cheat Sheet

 






















Kubernetes Commands 

1. kubectl get pods -n namespacename


2. With default namespace


3. Connect to POD using bosybox.


4. Create pod using yaml file


Useful kubectl Commands

Below is a list of useful kubectl commands. Always specify your namespace san by flag -n san

  • kubectl get pods -n san - List of pods for namespace san
  • kubectl logs <pod-name> -n san - Log for a specific pod
  • kubectl logs <pod-name> -c <container-name> -n san - Log for a specific container of a specific pod. If -c is not specified, it displays default container log. Helpful when you want to get daprd log.
  • kubectl logs <pod-name> --timestamps --since 1h -n san - Log for a specific pod with timestamps for last one hour.
  • kubectl logs <pod-name> -n san --previous - Log for a specific pod for last instance, before restart. Helpful in crash.
  • kubectl exec <pod-name> -n maui -- env -- check environment variables of a pod

No comments:

Post a Comment

Pages