agoda-com / agoda-com/macOS-vz-kubelet
502 Bad Gateway on Kubectl exec
- Dominant language
- Go
- Stars
- 402
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
# Question
I have my kubernetes cluster deployed using RKE2. The macOS-vz-kubelet works when: joining the cluster, creating and deleting pod (i.e. the macos vm is able to be created, and can be remote controlled via ssh as well).
However, when I am tring to connect to the pod using `kubectl exec`, it always shows 502 response.
```
root@gpu-node1:/home/it# kubectl exec macos -- /bin/zsh -c "echo 1"
error: Internal error occurred: error sending request: Post "https://10.10.2.24:10250/exec/default/macos/macos?command=%2Fbin%2Fzsh&command=-c&command=echo+1&error=1&output=1": proxy error from 127.0.0.1:9345 while dialing 10.10.2.24:10250, code 502: 502 Bad Gateway
```
I have tried to ping the macos-vz-kubelet from any of the rancher-proxy, and the macos-vz-kubelet is reacheable.
```
root@gpu-node1:/home/it# kubectl exec -it pod/kube-proxy-10.10.2.17 -n kube-system -- /bin/sh
# nc -vz 10.10.2.24:10250
10.10.2.24:10250 (10.10.2.24:10250) open
#
root@gpu-node1:/home/it# kubectl exec -it pod/kube-proxy-10.10.2.22 -n kube-system -- /bin/sh
# nc -vz 10.10.2.24:10250
10.10.2.24:10250 (10.10.2.24:10250) open
#
```
Here is the describtion of macos pod on macos-vz-kubelet (the many creation due to I restarted the exe many times), the pod is generated base on the example yaml:
```
Name: macos
Namespace: default
Priority: 0
Service Account: default
Node: 10.10.2.24/10.10.2.24
Start Time: Thu, 06 Nov 2025 16:52:40 +0000
Labels:
Annotations:
Status: Running
IP: 192.168.64.15
IPs:
IP: 192.168.64.15
Containers:
macos:
Container ID: vz://c6480239376b4c4a2a524cbd251af5af24ba141e63a35feffc2a191cd4dafab4
Image: registry.hystudio.group/private/macos:26
Image ID:
Port:
Host Port:
State: Running
Started: Thu, 06 Nov 2025 16:52:40 +0000
Ready: True
Restart Count: 0
Requests:
cpu: 4
memory: 12Gi
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-tnmq9 (ro)
Conditions:
Type Status
PodScheduled True
Initialized True
Ready True
Volumes:
kube-api-access-tnmq9:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
Optional: false
DownwardAPI: true
QoS Class: Burstable
Node-Selectors: kubernetes.io/os=darwin
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
virtual-kubelet.io/provider=macos-vz:NoSchedule
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 13m macos-vz-kubelet Pulling image "registry.hystudio.group/private/macos:26"
Normal ProviderCreateSuccess 13m 10.10.2.24/pod-controller Create pod in provider successfully
Normal Pulled 13m macos-vz-kubelet Successfully pulled image "registry.hystudio.group/private/macos:26" in 158.415416ms
Normal Scheduled 13m default-scheduler Successfully assigned default/macos to 10.10.2.24
Normal Created 13m macos-vz-kubelet Created container macos
Normal Started 13m macos-vz-kubelet Started container macos
Normal Pulling 6m10s macos-vz-kubelet Pulling image "registry.hystudio.group/private/macos:26"
Normal ProviderCreateSuccess 6m10s 10.10.2.24/pod-controller Create pod in provider successfully
Normal Pulled 6m9s macos-vz-kubelet Successfully pulled image "registry.hystudio.group/private/macos:26" in 112.535334ms
Normal Created 6m9s macos-vz-kubelet Created container macos
Normal Started 6m1s macos-vz-kubelet Started container macos
```
From the mac machine, the macos pod is able to be remote controlled via ssh:
```
it@macos-node2 ~ % ssh it@192.168.64.15
(it@192.168.64.15) Password:
(it@192.168.64.15) Password:
Last login: Thu Nov 6 09:04:09 2025 from 192.168.64.1
it@itdexuniji ~ % ip a
zsh: command not found: ip
it@itdexuniji ~ % ifconfig
lo0: flags=8049 mtu 16384
options=1203
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201
gif0: flags=8010 mtu 1280
stf0: flags=0<> mtu 1280
anpi0: flags=8863 mtu 1500
options=400
ether 6a:4c:a0:02:7d:63
media: none
status: inactive
en1: flags=8863 mtu 1500
options=400
ether 6a:4c:a0:02:7d:43
nd6 options=201
media: none
status: inactive
en0: flags=8863 mtu 1500
options=463
ether 46:66:fe:69:be:28
inet6 fe80::143e:63b8:398a:5fb3%en0 prefixlen 64 secured scopeid 0x6
inet6 fd81:4553:7cf4:f777:1c3b:2bb6:f300:37d2 prefixlen 64 autoconf secured
inet 192.168.64.15 netmask 0xffffff00 broadcast 192.168.64.255
nd6 options=201
media: autoselect
status: active
it@itdexuniji ~ %
```
# Suggestion (Optional)
Contributor guide
Assessment
This issue has not been assessed yet.