我开始使用K3S,所以我绝对是一个新手。现在我想知道如何通过我自己或使用docker映像为pod创建.yaml文件。(找不到详细的信息)
我想要一个OpenVPN或任何其他建议的VPN服务器运行,所以我可以从任何地方访问我的家庭设备。如果有人能这么好,帮我一点忙,我就省事多了。
以前,我有一个OpenVPN服务器运行,当我只有1个Raspi。但是看起来从安装到配置的所有内容都随着k3s Kubernetes集群而改变了。
如何用Rancher制作k3s集群:https://youtu.be/X9fSMGkjtug
尝试了3个小时来弄清楚,发现没有真正的循序渐进的指导初学者…
我已经有一个Cloudflare ddns脚本运行更新我的域名与正确的IP。
非常感谢!
这里是他们的例子开放VPN客户端YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: openvpn-client
spec:
selector:
matchLabels:
app: openvpn-client
vpn: vpn-id
replicas: 1
template:
metadata:
labels:
app: openvpn-client
vpn: vpn-id
spec:
volumes:
- name: vpn-config
secret:
secretName: vpn-config
items:
- key: client.ovpn
path: client.ovpn
- name: vpn-auth
secret:
secretName: vpn-auth
items:
- key: auth.txt
path: auth.txt
- name: route-script
configMap:
name: route-script
items:
- key: route-override.sh
path: route-override.sh
- name: tmp
emptyDir: {}
initContainers:
- name: vpn-route-init
image: busybox
command: ['/bin/sh', '-c', 'cp /vpn/route-override.sh /tmp/route/route-override.sh; chown root:root /tmp/route/route-override.sh; chmod o+x /tmp/route/route-override.sh;']
volumeMounts:
- name: tmp
mountPath: /tmp/route
- name: route-script
mountPath: /vpn/route-override.sh
subPath: route-override.sh
containers:
- name: vpn
image: dperson/openvpn-client
command: ["/bin/sh","-c"]
args: ["openvpn --config 'vpn/client.ovpn' --auth-user-pass 'vpn/auth.txt' --script-security 3 --route-up /tmp/route/route-override.sh;"]
stdin: true
tty: true
securityContext:
privileged: true
capabilities:
add:
- NET_ADMIN
env:
- name: TZ
value: "Turkey"
volumeMounts:
- name: vpn-config
mountPath: /vpn/client.ovpn
subPath: client.ovpn
- name: vpn-auth
mountPath: /vpn/auth.txt
subPath: auth.txt
- name: tmp
mountPath: /tmp/route
- name: app1
image: python:3.6-stretch
command:
- sleep
- "100000"
tty: true
dnsConfig:
nameservers:
- 8.8.8.8
- 8.8.4.4
您也可以阅读更多关于部署:https://bugraoz93.medium.com/openvpn-client-in-a-pod-kubernetes-d3345c66b014
也可以使用HELM<图表/strong>这将使在Kubernetes上设置任何东西变得容易。通过预制 YAML 脚本:https://itnext.io/use-helm-to-deploy-openvpn-in-kubernetes-to-access-pods-and-services-217dec344f13
Docker Open VPN: https://github.com/dperson/openvpn-client