jodevsa / wireguard-operator

Painless deployment of wireguard on kubernetes
MIT License
611 stars 35 forks source link

Peers can't contact eachother over the network #180

Open Twi opened 6 days ago

Twi commented 6 days ago

Describe the bug I want to create a network such that peers can contact eachother as if they were on the same physical network segment.

To Reproduce Steps to reproduce the behavior:

apiVersion: v1
kind: Namespace
metadata:
  name: wireguard
---
apiVersion: vpn.wireguard-operator.io/v1alpha1
kind: Wireguard
metadata:
  name: "ponyville"
  namespace: wireguard
spec:
  mtu: "1380"
  serviceType: "NodePort"
  enableIpForwardOnPodInit: true
---
apiVersion: vpn.wireguard-operator.io/v1alpha1
kind: WireguardPeer
metadata:
  name: rainbow-dash
  namespace: wireguard
spec:
  wireguardRef: "ponyville"
---
apiVersion: vpn.wireguard-operator.io/v1alpha1
kind: WireguardPeer
metadata:
  name: rarity
  namespace: wireguard
spec:
  wireguardRef: "ponyville"

Expected behavior Node rainbow-dash to be able to ping node rarity and connect over TCP/UDP/IP.

Additional context Add any other context about the problem here.

jodevsa commented 2 days ago

Hi @Twi,

Thank you for openning the issue. I have tried to reproduce and at least I can verify that ICMP connectivity (ping) between the nodes is possible.

Screenshot 2024-07-01 at 00 15 04

How are you verifying this?

jodevsa commented 2 days ago

HTTP (TCP) is also possible between the peers

jodevsa commented 2 days ago

Can you try to also check connectivity from the wireguard pod itself. here are some tips on how you can debug this:

find out the wireguard pod

kubectl get pods -lapp=wireguard -n NAMESPACE_YOU_USED

Screenshot 2024-07-01 at 00 32 02

bash into the wireguard pod

kubectl exec -it -c agent -- bash

Screenshot 2024-07-01 at 00 32 30

list connected peers

wg

Screenshot 2024-07-01 at 00 32 42

list iptables rules

iptables -L

those should be similar to what I have as you haven't configured any networkpolicy

Screenshot 2024-07-01 at 00 35 47

connectivity check

ping 10.8.0.2 ping 10.8.0.3

Screenshot 2024-07-01 at 00 36 17

You could also do a tcpdump on the pod and analyse the logs. I'll be happy to help you debug this further and available for a quick call if needed