Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2019-10-07 03:11:02
Size: 257
Editor: PieterSmit
Comment:
Revision 3 as of 2019-10-07 03:20:35
Size: 548
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
   * Note: xargs The -t option prints each command that will be executed to the terminal. {{{
kubectl get pods | grep etl | awk -F' ' '{print $1}' | xargs kubectl get pod
   * Note: xargs
     *
The -t option prints each command that will be executed to the terminal.
     * The -p command will print the command to be executed and prompt the user to run it.
     * -I flag. This replaces occurrences of the argument with the argument passed to xargs e.g. -I % 'echo %;echo %'
     * -n 1 , number of paramerters to group on command line
   *
{{{
kubectl get pods | grep etl | awk -F' ' '{print $1}' | xargs -t kubectl get pod

k8s/Admin snippets

Multiple pod operations

  • Using xargs.
    • Note: xargs
      • The -t option prints each command that will be executed to the terminal.
      • The -p command will print the command to be executed and prompt the user to run it.
      • -I flag. This replaces occurrences of the argument with the argument passed to xargs e.g. -I % 'echo %;echo %'
      • -n 1 , number of paramerters to group on command line
    • kubectl get pods | grep etl | awk -F' ' '{print $1}' | xargs -t kubectl get pod

k8s/Admin (last edited 2023-11-30 19:57:48 by PieterSmit)