Differences between revisions 8 and 9
Revision 8 as of 2021-10-31 09:20:03
Size: 881
Editor: PieterSmit
Comment:
Revision 9 as of 2023-11-30 19:57:48
Size: 856
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
$ kubectl run -i --tty --rm my-container --generator="run-pod/v1" --image=debian /bin/bash $ kubectl run -i --tty --rm my-container --image=debian /bin/bash

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 parameters to group on command line
    • kubectl get pods | grep etl | awk -F' ' '{print $1}' | xargs -t kubectl get pod
  • Launch container in k8s cluster

    $ kubectl run -i --tty --rm my-container --image=debian /bin/bash
    # apt-get update && apt-get install openssh-client -y
  • dns lookup on minimalist pod with no dig / nslookup use getent

    getent hosts www.google.com


CategoryK8sKubernetes

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