Unable to connect from Mac to k3s cluster deployed in Orb Linux VM.
Opened this issue · 1 comments
Describe the bug
Environment:
Host MacOs- 15.1 (24B83), M1
OrbStack- Version 1.8.1 (18374)
Orb VM- Ubuntu Jammy
Linux ubuntu 6.11.6-orbstack-00279-g28c6c77332e6 #57 SMP Mon Nov 4 08:11:30 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
k3s version-
k3s version v1.30.6+k3s1 (1829eaae)
go version go1.22.8
I have deployed lightweight k3s cluster on a Ubuntu VM. Then I have deployed my app deployment with loadbalancer service:
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: javaspace
name: my-spring-app-deploy
labels:
app: my-spring-app
spec:
replicas: 2
selector:
matchLabels:
app: my-spring-app
template:
metadata:
labels:
app: my-spring-app
spec:
containers:
- name: my-spring-app-container
image: docker.io/library/my-spring-app:1.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
apiVersion: "v1"
kind: "Service"
metadata:
annotations: {}
labels: {}
name: "my-spring-app-service"
namespace: javaspace
spec:
selector:
app: "my-spring-app"
type: LoadBalancer
ports:
- name: http
port: 8080
targetPort: 8080
nodePort: 32000
protocol: TCP
ISSUE: I cannot connect from my local Mac to the app deployed in k3s cluster running in the Orb VM. But if I ssh into the Orb VM then i can connect to my app.
Outputs after ssh into vm
> ssh harshit@ubuntu@orb
> kubectl -n javaspace get po
NAME READY STATUS RESTARTS AGE
my-spring-app-deploy-7c94694b45-88qd6 1/1 Running 0 11h
my-spring-app-deploy-7c94694b45-zt9lr 1/1 Running 0 11h
> ip addr
4: eth0@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 0a:93:e7:d3:f3:6e brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 198.19.249.50/24 metric 100 brd 198.19.249.255 scope global dynamic eth0
> curl -I 198.19.249.50:8080/hello
HTTP/1.1 200
Content-Type: application/json
Transfer-Encoding: chunked
Date: Tue, 12 Nov 2024 08:29:44 GMT
> curl -I localhost:8080/hello
HTTP/1.1 200
> kubectl -n javaspace get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-spring-app-service LoadBalancer 10.43.213.207 198.19.249.37,198.19.249.50 8080:32000/TCP 11h
> curl -I 198.19.249.37:8080/hello
HTTP/1.1 200
As per https://docs.orbstack.dev/machines/network#connecting-from-mac-to-machines I should be able to connect to VM from Mac using VM's primary interface eth0 IPv4 address i.e 198.19.249.50
in this case. But I am unable able to curl at default port 80 from Mac and also i am unable to curl at 198.19.249.50:8080 which should be routed to my kubernetes app. But ping from Mac to Vm is working
output from Mac:
> curl 198.19.249.50 curl: (7) Failed to connect to 198.19.249.50 port 80 after 1 ms: Couldn't connect to server
> curl -I 198.19.249.50:8080/hello
curl: (7) Failed to connect to 198.19.249.50 port 8080 after 1 ms: Couldn't connect to server
> ping 198.19.249.50
PING 198.19.249.50 (198.19.249.50): 56 data bytes
64 bytes from 198.19.249.50: icmp_seq=0 ttl=64 time=4.370 ms
64 bytes from 198.19.249.50: icmp_seq=1 ttl=64 time=2.896 ms
64 bytes from 198.19.249.50: icmp_seq=2 ttl=64 time=1.735 ms
64 bytes from 198.19.249.50: icmp_seq=3 ttl=64 time=1.906 ms
64 bytes from 198.19.249.50: icmp_seq=4 ttl=64 time=1.719 ms
64 bytes from 198.19.249.50: icmp_seq=5 ttl=64 time=1.390 ms
--- 198.19.249.50 ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.390/2.336/4.370/1.022 ms
To Reproduce
- create ubuntu jammy vm
- ssh into vm
- Install and run k3s single node cluster as system service
sudo curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -
- Configure the kubectl .kube file by grabbing the config from K3s:
mkdir /home/harshit/.kube && sudo kubectl config view --raw > /home/harshit/.kube/config
sudo chown -R harshit:harshit /home/harshit
sudo chmod 400 /home/harshit/.kube/config
- Deploy app deployment and loadbalancer service. (user any sample docker published image with correct port configs)
- curl from inside VM to loadbalancer ip, localhost, vm ip address. Successful
- curl from mac to Vm and loadbalancer external ip. Fails
- ping from mac to vm. Successful
Expected behavior
As per https://docs.orbstack.dev/machines/network#connecting-from-mac-to-machines
- I should be able to curl to VM
- If i am able to successfully curl from inside VM to any server, app, k8s app deployed in the VM, then I should be able to curl from Mac to all those apps in the VM using the VM IP Address.
Diagnostic report (REQUIRED)
OrbStack info:
Version: 1.8.1
Commit: 442ca0f634f1e62aa1f00c2c54353e69830cc4d5 (v1.8.1)
System info:
macOS: 15.1 (24B83)
CPU: arm64, 10 cores
CPU model: Apple M1 Pro
Model: MacBookPro18,1
Memory: 16 GiB
Full report: https://orbstack.dev/_admin/diag/orbstack-diagreport_2024-11-12T08-45-35.462334Z.zip
Screenshots and additional context (optional)
No response
Can not reproduce in 1.8.2. Can you try it in the new version?