I'm rookie to k8s.
I know the pod IP is set in range by --cluster-cidr. eg. 10.244.0.0/18
My question is how to access the pod IP from outside the k8s cluster.
I heard of 2 ways to do that:
/etc/docker/daemon.json, then add route records at the router device by ip route add 10.244.0.0/18 via {k8sNodeIp}(or something like that, I dont know details).These solutions are from two different teams.
I dont know if the k8s network plugin got involved, the first one uses flannel and the last one uses calico.
Any docs about that?
You can use kubectl port-forward to talk directly to containers in Pods for the purposes of debugging / development.
E.g. kubectl port-forward mypod 5000:6000
See docs here
This command will set up a proxy on your workstation so that you can run, for example:
curl localhost:5000/api/v1/statusThis request will be forwarded to the API Server, which will then forward your request to the Pod you specify in the port-forward command.