Deploying Stateless Microservices: Introduction
22%
Accessing Pods and Port Forwarding
A Pod does not expose any external address or port. If we want to see the Flask application running, we need to forward the internal Pod port to one of the ports on our workspace server.
Here is the general syntax for port forwarding:
kubectl port-forward : -n
Here is how we can do it in our case:
# Kill any container running on port 5000
docker kill $(docker ps -q --filter "publish=5000")
# Port forward the Pod port 5000 to local port 5000
kubectl port-forward ${POD_NAME} 5000:5000 -n stateless-flask > /dev/null 2Cloud-Native Microservices With Kubernetes - 2nd Edition
A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in KubernetesEnroll now to unlock all content and receive all future updates for free.
