Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to run Merbridge in debug mode (VScode) #239

Open
abhayakyy opened this issue Nov 6, 2022 · 4 comments
Open

Error when trying to run Merbridge in debug mode (VScode) #239

abhayakyy opened this issue Nov 6, 2022 · 4 comments

Comments

@abhayakyy
Copy link

abhayakyy commented Nov 6, 2022

Bug Description

    • The error when trying to run the code base in the main branch using "dlv" is
Build Error: go build -o /home/xxx/github/merbridge/app/__debug_bin -gcflags all=-N -l .
# istio.io/istio/pilot/pkg/config/memory
../../../go/pkg/mod/istio.io/istio@v0.0.0-20220923030445-cd2dc8636a65/pilot/pkg/config/memory/controller.go:36:17: undefined: atomic.Bool
note: module requires Go 1.19
# istio.io/istio/pilot/pkg/config/kube/ingress
../../../go/pkg/mod/istio.io/istio@v0.0.0-20220923030445-cd2dc8636a65/pilot/pkg/config/kube/ingress/controller.go:100:17: undefined: atomic.Bool
note: module requires Go 1.19 (exit status 2)

Go Version is set using GVM 
Go version =>  go version go1.19 linux/amd64
Make version => GNU Make 4.3 (Built for x86_64-pc-linux-gnu)
    • Running command "go run -exec sudo ./app/main.go" gives the following error
[ -f bpf/mb_connect.c ] && make -C bpf load || make -C bpf load-from-obj
make[1]: Entering directory '/home/xxx/github/merbridge/bpf'
clang -O2 -g  -Wall -target bpf -I/usr/include/x86_64-linux-gnu  -DMESH=1 -DENABLE_IPV4=1 -DENABLE_IPV6=0 -DUSE_RECONNECT -c mb_connect.c -o mb_connect.o
make[1]: clang: No such file or directory
make[1]: *** [Makefile:79: mb_connect.o] Error 127
make[1]: Leaving directory '/home/xxx/github/merbridge/bpf'
make[1]: Entering directory '/home/xxx/github/merbridge/bpf'
sudo mount -t bpf bpf /sys/fs/bpf
sudo mkdir -p /sys/fs/bpf/tc/globals
[ -f /sys/fs/bpf/cookie_original_dst ] || sudo bpftool map create /sys/fs/bpf/cookie_original_dst type lru_hash key 8 value 24 entries 65535 name cookie_original_dst
sudo: bpftool: command not found
make[1]: *** [Makefile:91: load-map-cookie_original_dst] Error 1
make[1]: Leaving directory '/home/xxx/github/merbridge/bpf'
make: *** [Makefile:3: load] Error 2
Error: failed to load ebpf programs: unexpected exit code: 2, err: exit status 2
Usage:
  mbctl [flags]

Flags:
      --cni-bin-dir string      /opt/cni/bin mount path (default "/host/opt/cni/bin")
      --cni-config-dir string   /etc/cni/net.d mount path (default "/host/etc/cni/net.d")
      --cni-mode                Enable Merbridge CNI plugin
  -d, --debug                   Debug mode
      --enable-hot-restart      enable hot restart
  -h, --help                    help for mbctl
      --host-proc string        /proc mount path (default "/host/proc")
      --host-var-run string     /var/run mount path (default "/host/var/run")
  -k, --kind                    Enable when Kubernetes is running in Kind
      --kubeconfig string       Kubernetes configuration file
      --kubecontext string      The name of the kube config context to use
  -m, --mode string             Service mesh mode, current support istio, linkerd and kuma (default "istio")
  -r, --use-reconnect           Use re-connect mode for same-node acceleration (default true)

exit status 1

Version

$uname -a 
Linux xxx 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

istioctl version 
1.15.3
@kebe7jun
Copy link
Member

kebe7jun commented Nov 6, 2022

It looks like you don't have clang and bpftool installed on your system.

@kebe7jun
Copy link
Member

kebe7jun commented Nov 6, 2022

For vscode, you should change the go version of vscode used to 1.19(try google).

@abhayakyy
Copy link
Author

installing these fixed the issue but now I am getting this error

2022-11-06T14:07:52.281386Z error klog pkg/mod/k8s.io/client-go@v0.25.1/tools/cache/reflector.go:169: Failed to watch *v1.Pod: failed to list *v1.Pod: Get "https://127.0.0.1:45007/api/v1/pods?fieldSelector=spec.nodeName%3Droy&limit=500&resourceVersion=0": dial tcp 127.0.0.1:45007: connect: connection refused

Do I need a running k8s cluster with istio installed on it ?

@kebe7jun
Copy link
Member

kebe7jun commented Nov 7, 2022

installing these fixed the issue but now I am getting this error

2022-11-06T14:07:52.281386Z error klog pkg/mod/k8s.io/client-go@v0.25.1/tools/cache/reflector.go:169: Failed to watch *v1.Pod: failed to list *v1.Pod: Get "https://127.0.0.1:45007/api/v1/pods?fieldSelector=spec.nodeName%3Droy&limit=500&resourceVersion=0": dial tcp 127.0.0.1:45007: connect: connection refused

Do I need a running k8s cluster with istio installed on it ?

Yes, you need to install a Kubernetes cluster with Istio locally.
You can either try Kind to create a new cluster and make sure the root user can access it directly via kubectl, or set the KUBECONFIG environment variable manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants