Gravitational Teleport docker-compose簡單執行
阿新 • • 發佈:2018-12-28
Gravitational Teleport 可以作為堡壘機進行使用,為了測試方便使用docker-compose
執行一個all in one 的demo
備註: 官方提供的docker-compose 檔案版太舊,而且複雜
環境準備
- docker-compose 檔案
version: '2'
services:
one:
image: quay.io/gravitational/teleport:2.7.3
container_name: one
mem_limit: 300m
memswap_limit: 0
ports:
- "3080:3080"
- "3023:3023"
- "3025:3025"
- "3024:3024"
volumes:
- ./one.yaml:/etc/teleport/teleport.yaml
- ./data/one:/var/lib/teleport
- certs:/mnt/shared/certs
networks:
teleport:
ipv4_address: 172.10.1.1
aliases:
- one-lb
networks:
teleport:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.10.1.0/16
ip_range: 172.10.1.0/24
gateway: 172.10.1.254
volumes:
certs:
- Teleport 配置檔案
為了方便,關閉了2f,同時包好的node proxy auth 的role
teleport:
nodename: one
advertise_ip: 172.10.1.1
log:
output: /var/lib/teleport/teleport.log
severity: INFO
data_dir: /var/lib/teleport
storage:
path: /var/lib/teleport/backend
type: dir
auth_service:
enabled: yes
authentication:
type: local
second_factor: off
cluster_name: one
tokens:
- "node,auth,proxy:foo"
- "trustedcluster:bar"
ssh_service:
enabled: yes
labels:
cluster: one
commands:
- name: kernel
command: [/bin/uname, -r]
period: 5m
proxy_service:
enabled: yes
執行&&測試
- 啟動
docker-compose up -d
- 新增使用者
因為使用的local ,inside 容器
tctl users add root
Signup token has been created and is valid for 1 hours. Share this URL with the user:
https://one:3080/web/newuser/f14e192e8adc32a01d1f7ca945225ace
NOTE: Make sure one:3080 points at a Teleport proxy which users can access.
- 開啟web 介面配置使用者
open https://localhost:3080/web/newuser/f14e192e8adc32a01d1f7ca945225ace - 效果
- 管理(web ssh)
說明
這個只是一個簡單的all in one 的demo,實際上也可以管理k8s
參考資料
https://github.com/rongfengliang/teleport-docker-compose
https://gravitational.com/teleport/docs/quickstart/
https://gravitational.com/teleport/docs/admin-guide/#configuration
https://quay.io/repository/gravitational/teleport?tab=tags