This is for scenario where we want to access kubernetes cluster on our mac that is created with colima.
The kube api server is a k0s docker container running inside colima with url: https://172.17.0.2:6443.
- Modify
/etc/pf.conf
file to be like below, note that therdr pass ...
line must be exactly beforeanchor
andload anchor
.
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
rdr pass on lo0 inet proto tcp from any to 172.17.0.2 port 6443 -> 127.0.0.1 port 6443
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
- Reload pf setting
sudo pfctl -f /etc/pf.conf
sudo pfctl -e
sudo pfctl -vvsn
sudo route add 172.17.0.0/24 127.0.0.1
- Setup route
sudo route add 172.17.0.0/24 127.0.0.1