Here is my working condition:
- My laptop @ 192.168.12.85 gw 192.168.1.254
- Controll plane : bino-k8-master @ 192.168.1.66 gw 192.168.1.247
- worker node : bino-k8-wnode1 @ 192.168.1.67 gw 192.168.1.247
k8s cluster is build per https://www.hostafrica.ng/blog/kubernetes/kubernetes-ubuntu-20-containerd/
I build simple flask app image per https://faun.pub/run-your-flask-app-on-kubernetes-ff03854db842
Currently, the app is running:
ubuntu@bino-k8-master:~$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
flask-k8s-deployment-59bd54648c-jdgxv 1/1 Running 0 16h 10.244.1.8 bino-k8-wnode1 <none> <none>
also the service:
ubuntu@bino-k8-master:~$ kubectl get services -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
flask-k8s-service LoadBalancer 10.96.179.198 <pending> 6000:30787/TCP 17h app=flask-k8s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 18h <none>
But I can not access the app or service from control plane ... curl http://10.244.1.8:5000 and http://10.96.179.198:6000 both failed (no message, just stuck)
But both curl will work if I did it from the worker node.
Kindly please tell me what to do to make the app or service can be acessed from my laptop (192.168.1.85)
Sincerely
Bino
CodePudding user response:
If you want to access it from a laptop you need to get the extenal-ip of the load balancer. It is not on screenshot yet. If you want just to test it, you can port forward with correct ports.
kubectl port-forward flask-k8s-deployment-59bd54648c-jdgxv 3000:3000
and then just call
http://localhost:3000
If you want to access it from internet, create https://kubernetes.io/docs/concepts/services-networking/ingress/