文章目录
- docker方式
- httpbin
- it-tools
- linux-command
- myip
- reference
- docker-compose安装
- k8s方式
docker方式
httpbin
A simple HTTP Request & Response Service
https://httpbin.org/
https://github.com/postmanlabs/httpbin
https://github.com/mccutchen/go-httpbin
docker rm -f httpbin;
docker run --name httpbin \
--network macvlan -dp 80:80 \
--restart=always \
kennethreitz/httpbin
it-tools
Handy tools for developers
https://it-tools.tech/
https://github.com/CorentinTh/it-tools
docker run --name it-tools \
--network macvlan -p 80:80 \
--restart unless-stopped \
corentinth/it-tools
linux-command
Linux命令搜索
https://wangchujiang.com/linux-command/
https://github.com/jaywcjlove/linux-command
docker rm -f linux-command;
docker run --name linux-command \
--network macvlan -dp 3000:3000 \
--restart=always \
wcjiang/linux-command
myip
IP 信息
https://ipcheck.ing/
https://github.com/jason5ng32/MyIP
docker rm -f myip;
docker run --name myip \
--network macvlan -dp 18966:18966 \
--restart=always \
jason5ng32/myip
reference
Share quick reference cheat sheet for developers
https://wangchujiang.com/reference/
https://github.com/jaywcjlove/reference
https://hub.docker.com/r/wcjiang/reference
docker rm -f reference;
docker run --name reference \
--network macvlan -dp 3000:3000 \
--restart=always \
wcjiang/reference
docker-compose安装
docker-compose up -d
name: stateless
services:httpbin:container_name: httpbinports:- 80restart: alwaysimage: kennethreitz/httpbinit-tools:container_name: it-toolsports:- 80restart: unless-stoppedimage: corentinth/it-toolslinux-command:container_name: linux-commandports:- 3000restart: alwaysimage: wcjiang/linux-commandmyip:container_name: myipports:- 18966restart: alwaysimage: jason5ng32/myipreference:container_name: referenceports:- 3000restart: alwaysimage: wcjiang/reference
k8s方式
用豆包生成k8s的yaml:
将上面的docker-compose转为k8s yaml格式,并配置对应traefik。
放到一个文件中吧,把example.com改为k8s.home.love。
kubectl apply -f all.yaml -n stateless
---
apiVersion: apps/v1
kind: Deployment
metadata:name: httpbin-deployment
spec:replicas: 1selector:matchLabels:app: httpbintemplate:metadata:labels:app: httpbinspec:containers:- name: httpbinimage: kennethreitz/httpbinports:- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:name: httpbin-service
spec:selector:app: httpbinports:- protocol: TCPport: 80targetPort: 80
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:name: httpbin-ingressroute
spec:entryPoints:- webroutes:- match: Host(`httpbin.k8s.home.love`)kind: Ruleservices:- name: httpbin-serviceport: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:name: it-tools-deployment
spec:replicas: 1selector:matchLabels:app: it-toolstemplate:metadata:labels:app: it-toolsspec:containers:- name: it-toolsimage: corentinth/it-toolsports:- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:name: it-tools-service
spec:selector:app: it-toolsports:- protocol: TCPport: 80targetPort: 80
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:name: it-tools-ingressroute
spec:entryPoints:- webroutes:- match: Host(`it-tools.k8s.home.love`)kind: Ruleservices:- name: it-tools-serviceport: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:name: linux-command-deployment
spec:replicas: 1selector:matchLabels:app: linux-commandtemplate:metadata:labels:app: linux-commandspec:containers:- name: linux-commandimage: wcjiang/linux-commandports:- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:name: linux-command-service
spec:selector:app: linux-commandports:- protocol: TCPport: 3000targetPort: 3000
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:name: linux-command-ingressroute
spec:entryPoints:- webroutes:- match: Host(`linux-command.k8s.home.love`)kind: Ruleservices:- name: linux-command-serviceport: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:name: myip-deployment
spec:replicas: 1selector:matchLabels:app: myiptemplate:metadata:labels:app: myipspec:containers:- name: myipimage: jason5ng32/myipports:- containerPort: 18966
---
apiVersion: v1
kind: Service
metadata:name: myip-service
spec:selector:app: myipports:- protocol: TCPport: 18966targetPort: 18966
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:name: myip-ingressroute
spec:entryPoints:- webroutes:- match: Host(`myip.k8s.home.love`)kind: Ruleservices:- name: myip-serviceport: 18966
---
apiVersion: apps/v1
kind: Deployment
metadata:name: reference-deployment
spec:replicas: 1selector:matchLabels:app: referencetemplate:metadata:labels:app: referencespec:containers:- name: referenceimage: wcjiang/referenceports:- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:name: reference-service
spec:selector:app: referenceports:- protocol: TCPport: 3000targetPort: 3000
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:name: reference-ingressroute
spec:entryPoints:- webroutes:- match: Host(`reference.k8s.home.love`)kind: Ruleservices:- name: reference-serviceport: 3000