Extreme Thinking
k8s sock5 go proxy

2023-03-13


go-proxy

kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-proxy
  labels:
    app: go-proxy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: go-proxy
  template:
    metadata:
      labels:
        app: go-proxy
    spec:
      containers:
      - name: go-proxy
        imagePullPolicy: Always
        image: serjs/go-socks5-proxy
        ports:
        - containerPort: 1080
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: go-proxy-clusterip
spec:
  ports:
  - port: 1080
    protocol: TCP
    targetPort: 1080
  selector:
    app: go-proxy
  type: LoadBalancer
EOF

TOR socks proxy

kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: torproxy
  labels:
    app: torproxy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: torproxy
  template:
    metadata:
      labels:
        app: torproxy
    spec:
      containers:
      - name: torproxy
        imagePullPolicy: Always
        image: dockage/tor-privoxy
        ports:
        - containerPort: 9050
EOF
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: torproxy-clusterip
spec:
  ports:
  - port: 9050
    protocol: TCP
    targetPort: 9050
  selector:
    app: torproxy
  type: LoadBalancer
EOF

簡單方式

kubectl create deployment go-proxy --image serjs/go-socks5-proxy --replicas 1
kubectl expose deployment go-proxy --port 1080  --type=LoadBalancer 

刪除

kubectl delete svc,deploy go-proxy