Skip to content

Instantly share code, notes, and snippets.

@danackerson
Last active November 22, 2024 12:31
Show Gist options
  • Save danackerson/62c242ee858e56a78957d524923ac07c to your computer and use it in GitHub Desktop.
Save danackerson/62c242ee858e56a78957d524923ac07c to your computer and use it in GitHub Desktop.

Revisions

  1. danackerson revised this gist Nov 22, 2024. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,17 @@ alias k='sudo kubectl'
    alias kp='k get po'
    alias kap='k get pods --all-namespaces -o wide'
    alias kas='k get services --all-namespaces -o wide'

    ksh() {
    namespace="gitlab-managed-apps"

    case "$#" in
    0) echo "Usage: ksh <app> (<namespace>)" && return;;
    2) namespace="$2";;
    esac

    kubectl exec -it $(kubectl get pods -n $namespace -l app="$1" -o jsonpath='{.items[0].metadata.name}') -n $namespace -- /bin/bash;
    }
    kl() {
    k logs $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n)
    }
  2. danackerson revised this gist Feb 9, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,9 @@ alias gp='git push'

    ### K8S ###
    alias k='sudo kubectl'
    alias kp='k get po'
    alias kap='k get pods --all-namespaces -o wide'
    alias kas='k get services --all-namespaces -o wide'
    kl() {
    k logs $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n)
    }
  3. danackerson created this gist Dec 24, 2020.
    14 changes: 14 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    ### GIT ###
    alias gs='git status'
    alias gd='git diff'
    alias gc='git commit -am'
    alias gp='git push'

    ### K8S ###
    alias k='sudo kubectl'
    kl() {
    k logs $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n)
    }
    kx() {
    k exec -it $(k get po | grep $1 | awk '{print $1; exit}' | tr -d \\n) -- $2
    }