what is the root password of telepresence in kubernetes remote debugging

5/1/2020

I am using telepresence to remote debugging the kubernetes cluster, and I am log in cluster using command:

telepresence

but when I want to install some software in the telepresence pod:

sudo apt-get install wget

and I did not know the password of telepresence pod, so what should I do to install software?

-- Dolphin
kubernetes

1 Answer

5/2/2020

you could using this script to login pod as root:

#!/usr/bin/env bash
set -xe

POD=$(kubectl describe pod "$1")
NODE=$(echo "$POD" | grep -m1 Node | awk -F'/' '{print $2}')
CONTAINER=$(echo "$POD" | grep -m1 'Container ID' | awk -F 'docker://' '{print $2}')

CONTAINER_SHELL=${2:-bash}

set +e

ssh -t "$NODE" sudo docker exec --user 0 -it "$CONTAINER" "$CONTAINER_SHELL"

if [ "$?" -gt 0 ]; then
  set +x
  echo 'SSH into pod failed. If you see an error message similar to "executable file not found in $PATH", please try:'
  echo "$0 $1 sh"
fi

login like this:

./login-k8s-pod.sh flink-taskmanager-54d85f57c7-wd2nb
-- Dolphin
Source: StackOverflow