rootless-containers / usernetes

Kubernetes without the root privileges
https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2033-kubelet-in-userns-aka-rootless
Apache License 2.0
865 stars 58 forks source link

Remove `ip addr add "${U7S_HOST_IP}" dev eth0` #296

Closed AkihiroSuda closed 6 months ago

AkihiroSuda commented 1 year ago

https://github.com/rootless-containers/usernetes/blob/9c454e1bf8dc81d18a49ad0bdf932fec08944e90/Dockerfile.d/u7s-entrypoint.sh#L7-L9

It is weird to assign the host IP to the eth0 of the node container.

Depends on:

aojea commented 1 year ago

do you want to configure the externalIP of the node?

aojea commented 1 year ago

if you start the kubelet with cloud-provider external you can update the status of the node object and it will pick those addresses, now you can do it with kubectl kubectl patch node --type=merge --subresource status --patch '.....'

AkihiroSuda commented 6 months ago

if you start the kubelet with cloud-provider external you can update the status of the node object and it will pick those addresses, now you can do it with kubectl kubectl patch node --type=merge --subresource status --patch '.....'

Thanks, but ClusterIPs such as 10.96.0.1 are still inaccessible from worker nodes (https://github.com/rootless-containers/usernetes/pull/323/commits/9374719668feb8299a3101d1af14df2a281508db , in WIP PR #323). Is there any additional step needed to configure kube-proxy (?) or something?


(worker)# iptables -L -t nat -n
[...]
Chain KUBE-SVC-NPX46M4PTMTKRN6Y (1 references)
target     prot opt source               destination         
KUBE-MARK-MASQ  6    -- !10.244.0.0/16        10.96.0.1            /* default/kubernetes:https cluster IP */ tcp dpt:443
KUBE-SEP-5AFECAHKOA3J44OW  0    --  0.0.0.0/0            0.0.0.0/0            /* default/kubernetes:https -> 10.100.156.2:6443 */

10.100.156.2 here is non-external IP of the control plane.

kubectl get endpoints kubernetes also shows this non-external IP, and this does not seem patchable

AkihiroSuda commented 6 months ago

Thanks @aojea , implemented your suggestion in https://github.com/rootless-containers/usernetes/releases/tag/gen2-v20240404.1 (#323)