- 添加配置
ConfigMap: 添加config.yaml
version: 1
log:
level: "warning"
dns:
servers:
- "*.*.*.*"
inbounds:
- protocol: vless
settings:
decryption: "none"
clients:
- id: "********************"
level: 1
listen: "0.0.0.0"
port: **
streamSettings:
network: "tcp"
outbounds:
- protocol: freedom
- 创建Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: xray
spec:
replicas: 1
selector:
matchLabels:
app: xray
template:
metadata:
labels:
app: xray
spec:
containers:
- name: xray
image: teddysun/xray:latest
command:
- /bin/sh
args:
- -c
- cp /mnt/xray-config/config.yaml /etc/xray/config.yaml && xray run -c /etc/xray/config.yaml
ports:
- containerPort: 10000
volumeMounts:
- name: xray-config
mountPath: /mnt/xray-config
volumes:
- name: xray-config
configMap:
name: xray-config
- 创建服务
apiVersion: v1
kind: Service
metadata:
name: xray
spec:
selector:
app: xray
ports:
- protocol: TCP
port: 10000
targetPort: 10000
type: LoadBalancer