美文网首页
K8s搭建Xray

K8s搭建Xray

作者: RalapHao | 来源:发表于2023-06-23 11:22 被阅读0次
    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
    

    相关文章

      网友评论

          本文标题:K8s搭建Xray

          本文链接:https://www.haomeiwen.com/subject/qztvydtx.html