telepresenceio / telepresence.io

The https://www.telepresence.io/ website
19 stars 31 forks source link

docs request: add info on auth when running telepresence in a container #180

Open nicks opened 1 year ago

nicks commented 1 year ago

There's currently a doc on running telepresence in a container:

https://github.com/telepresenceio/telepresence.io/blob/529193ba20a82485054739e4260283ee44866e1d/docs/pre-release/reference/inside-container.md

This will work if you use kubernetes token auth. This doc doesn't work if you use kubectl auth plugins. Each auth plugin will need a different approach.

Here are instructions for AWS:

Change your dockerfile to this:

FROM golang:1.20-alpine as auth-builder
RUN go install sigs.k8s.io/aws-iam-authenticator/cmd/aws-iam-authenticator@v0.5.9

# Dockerfile with telepresence and its prerequisites
FROM alpine:3.13

# Install Telepresence prerequisites
RUN apk add --no-cache curl iproute2 sshfs

# Download and install the telepresence binary
RUN curl -fL https://app.getambassador.io/download/tel2/linux/amd64/latest/telepresence -o telepresence && \
   install -o root -g root -m 0755 telepresence /usr/local/bin/telepresence

COPY --from=auth-builder /go/bin/aws-iam-authenticator ./aws-iam-authenticator
RUN install -o root -g root -m 0755 aws-iam-authenticator /usr/local/bin/aws-iam-authenticator && \
    rm aws-iam-authenticator

Change your docker run call to:

$ docker run \
  --cap-add=NET_ADMIN \
  --device /dev/net/tun:/dev/net/tun \
  --network=host \
  -v ~/.kube/config:/root/.kube/config \
  -v ~/.aws:/root/.aws \
  -it --rm tp-in-docker