K8s搭建Xray

2023-06-23  本文已影响0人  RalapHao
  1. 添加配置
    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
image.png
  1. 创建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
  1. 创建服务
apiVersion: v1
kind: Service
metadata:
  name: xray
spec:
  selector:
    app: xray
  ports:
    - protocol: TCP
      port: 10000
      targetPort: 10000
  type: LoadBalancer
上一篇下一篇

猜你喜欢

热点阅读