我正在研究如何使 OpenVPN 客户端在 Pod 的容器上工作,我解释了我所做的事情,但是您可以跳过我的所有解释并直接提供您的解决方案,如果可行的话,我不在乎将以下所有内容替换为您的步骤,我想让我的容器以外部和内部网络都可以工作的方式使用 VPN(例如 ExpressVPN)。
我有一个作为 OpenVPN 客户端的 docker 镜像,它可以与以下命令配合使用:
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun my-app /bin/bash
Run Code Online (Sandbox Code Playgroud)
docker 镜像有一个入口点 bash 脚本:
curl https://vpnvendor/configurations.zip -o /app/configurations.zip
mkdir -p /app/open_vpn/ip_vanish/config
unzip /app/configurations.zip -d /app/open_vpn/config
printf "username\npassword\n" > /app/open_vpn/vpn-auth.conf
cd /app/open_vpn/config
openvpn --config ./config.ovpn --auth-user-pass /app/open_vpn/vpn-auth.conf
Run Code Online (Sandbox Code Playgroud)
它工作正常,但是当我将它部署为 K8S Pod 中的容器时,它崩溃了,这是可以理解的,K8S 集群需要节点之间的内部网络通信,因此 VPN 破坏了它......我该如何让它工作?谷歌搜索很令人沮丧,没有一个解决方案有效,而且只有几个,有一个有类似的问题:OpenVPN-Client Pod on K8s - Local network unreachable 但不太明白,请帮忙。
由于 IPVanish 众所周知,让我们以他们的 ovpn 为例,我使用其他供应商,但可以访问 IPVanish 帐户,但它也不起作用:
client
dev tun
proto udp
remote lon-a52.ipvanish.com 443
resolv-retry infinite
nobind …Run Code Online (Sandbox Code Playgroud) 我一直在寻找如何在模板中使用 Vuex 动作而不输入所有动作名称,这就是我的代码的样子:
export default new Vuex.Store({ modules: articles, auth, blabla})
Run Code Online (Sandbox Code Playgroud)
我的articles.module.js 包含动作、getter 等,其中一个动作如下所示:
[ArticleActions.remote.FETCH_ALL]({commit}) {something axios stuff}
Run Code Online (Sandbox Code Playgroud)
它以命名空间为真导出:
export const articles = {
namespaced: true,
state: initialState,
mutations,
actions,
getters
};
Run Code Online (Sandbox Code Playgroud)
在我的组件 ArticleList.vue 中,我想在 mapActions 中使用该操作:
methods: {
...mapActions('articles', [ArticleActions.remote.FETCH_ALL])
}
Run Code Online (Sandbox Code Playgroud)
这有效,但我不想在我的模板中使用 ArticleActions.remote.FETCH_ALL 的值,我想要的是
methods: {
...mapActions('articles', [{fetchAll: ArticleActions.remote.FETCH_ALL}])
}
Run Code Online (Sandbox Code Playgroud)
所以我只需要:
mounted(){fetchAll();}
Run Code Online (Sandbox Code Playgroud)
代替
mounted(){ArticleActions.remote.FETCH_ALL();}
Run Code Online (Sandbox Code Playgroud)
我们能做到吗?