Execute the command "kubectl describe pod myapp-rc-wl284", each of them is running on a specific IP, internal to the node.
The Node IP (192.168.65.3), but you can’t access it directly because the forwarding rule to send the requests from the node IP to the pod IP is missing.
Kubernetes provides the services to do expose the POD.
A service has the task of exposing pods to a client or other pods, with an IP (or a DNS) and a port.
Can expose a specified pod or a group of pods (replicas).
The command to expose the replication controller
kubectl expose rc myapp-rc --name=myapp-rc-service --type=NodePort
- The --name option sets a name for the service.
- The --type option sets the service type, and can be one of the following four values: [ClusterIP, NodePort, LoadBalancer, ExternalName]
- Used the NodePort type to make the service available on a port, which we can retrieve with the describe command
- The NodePort type automatically creates a ClusterIP service used by the NodePort service to route the requests to the pods.
kubectl describe service myapp-rc-service
The browse the application http://localhost:31386/, because we have a local cluster.
No comments:
Post a Comment