Skip to content

Instantly share code, notes, and snippets.

@carlos-algms
Last active July 20, 2020 08:12
Show Gist options
  • Save carlos-algms/5b809a22e9ea4f34a4dfc32d91f3b9e2 to your computer and use it in GitHub Desktop.
Save carlos-algms/5b809a22e9ea4f34a4dfc32d91f3b9e2 to your computer and use it in GitHub Desktop.
Kubernetes login to first available pod for the namespace

usage

Type kfp followed by the name of your namespace to loging and access the shell bash from a running instance in Kubernetes.

kfp production
kfp qa
kfp () {
NAMESPACE=$1
POD=$(kubectl get pods -n $NAMESPACE | awk -F ' ' 'NR==2 { print $1 }')
kubectl exec -ti -n $NAMESPACE $POD bash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment