鉴于:
问:为什么无法从VPN实例ping / curl /访问POD ip?
我需要实现的是通过VPN隧道从本地网络内部连接到POD ip。
我究竟做错了什么?
@vpn-gateway:~$ curl -vvv 10.7.244.149:666
* Rebuilt URL to: 10.7.244.149:666/
* Trying 10.7.244.149...
* TCP_NODELAY set
VPN网关无法访问NodePort
EDIT2:服务配置:
apiVersion: v1
kind: Service
metadata:
labels:
app: scs-ui
name: scs-ui
spec:
clusterIP: None
ports:
- name: application
port: 666
selector:
app: scs-ui
刚刚找到解决方案:
在VPN / Kubernetes的地址范围内创建LB.这样,请求通过VPN从我的本地mashine路由到服务。
apiVersion: v1
kind: Service
metadata:
name: elassandra-ingress
annotations:
cloud.google.com/load-balancer-type: "Internal"
labels:
app: elassandra-ingress
spec:
type: LoadBalancer
loadBalancerIP: 10.164.0.100
ports:
- port: 9042
protocol: TCP
selector:
app: elassandra
如果您没有使用Nodeport,Load balancer和clusterIp等任何服务将您的pod暴露到互联网,那么无论如何都无法在kubernetes集群外部访问您的pod。
问:为什么无法从VPN实例ping / curl /访问POD ip?
Answer : without exposing pod outside the world you can not ping pod you can do it in kubernetes cluster network or inside cluster only your pod can be resolved, ping possible
要从本地网络访问您的pod,只需使用负载均衡器公开pod的端口。 Nodeport和loadbalancer与k8s服务一起使用。
使用服务公开pod,你可以ping并做所有事情。