Skip to content

Instantly share code, notes, and snippets.

@dirien
Last active October 9, 2021 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dirien/60895b95da51c2e2b825631a9b557941 to your computer and use it in GitHub Desktop.
Save dirien/60895b95da51c2e2b825631a9b557941 to your computer and use it in GitHub Desktop.
Teleport: PoC

Install teleport on Civo Instance

civo sshkey create key -k key.pub
Created an SSH key called key with ID 368a2903-92af-435b-aca4-6f361f409f37

civo instance create -i g3.medium -k 368a2903-92af-435b-aca4-6f361f409f37 -t 921fcb64-8abf-4a51-8823-027d9d75c1d4 -u root -w 
The instance late-summit has been created

ssh -i key root@<ip>

curl https://deb.releases.teleport.dev/teleport-pubkey.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://deb.releases.teleport.dev/ stable main'
sudo apt-get update
sudo apt-get install teleport

sudo teleport configure --acme --acme-email=your-email@example.com --cluster-name=tele.example.com -o file

tee /etc/systemd/system/teleport.service <<EOF
[Unit]
Description=Teleport Server
Documentation=https://goteleport.com/docs/getting-started/linux-server/

[Service]
WorkingDirectory=/
Type=simple
ExecStart=teleport start

Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

systemctl restart teleport.service
systemctl enable teleport.service

tctl users add teleport-admin --roles=editor,access --logins=root,ubuntu

Create 3 Cluster

cluster - Scaleway

scw k8s cluster create name=scaleway-cluster ingress=none pools.0.size=1 pools.0.node-type=DEV1-M pools.0.name=default

scw k8s kubeconfig install ef105cb1-6a8f-4a2c-9257-ab74b342655d
Kubeconfig for cluster ef105cb1-6a8f-4a2c-9257-ab74b342655d successfully written at /Users/dirien/.kube/config

On the teleport root server

TOKEN=$(tctl nodes add --roles=kube --ttl=10000h --format=json | jq -r '.[0]')
echo $TOKEN

On your client:

CLUSTER='scaleway-civo'
PROXY=teleport.ediri.online:443
TOKEN=xxx

helm upgrade -i teleport-agent teleport/teleport-kube-agent --set kubeClusterName=$CLUSTER --set proxyAddr=$PROXY --set authToken=$TOKEN --create-namespace --namespace=teleport-agent

Civo

civo k3s create civo-cluster --nodes=1 --size=g3.k3s.large
civo k3s config civo-cluster --save --merge
helm upgrade -i teleport-agent teleport/teleport-kube-agent --set kubeClusterName=$CLUSTER --set proxyAddr=$PROXY --set authToken=$TOKEN --create-namespace --namespace=teleport-agent

Check the Clusters

Create a new user, with only acces rights.

tsh login --proxy=teleport.ediri.online --user=viwer


tsh kube ls
Kube Cluster Name Selected
----------------- --------
civo-cluster
scaleway-civo

tsh kube login civo-cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment