Accessing Apps from Outside the Cluster
Learn how we can access an application from outside the cluster using Services.
We'll cover the following...
NodePort
Services
NodePort
Services build on top of ClusterIP
Services by adding a dedicated port on every cluster node that external clients can use. We call this dedicated port the NodePort
.
The following YAML shows a NodePort
Service called skippy
.
Press + to interact
apiVersion: v1kind: Servicemetadata:name: skippy <<==== Registered with the internal cluster DNS (ClusterIP)spec:type: NodePort <<==== Service typeports:- port: 8080 <<==== ClusterIP porttargetPort: 9000 <<==== Application port in containernodePort: 30050 <<==== External port on every cluster node (NodePort)selector:app: hello-world
Posting this to the cluster will create a ClusterIP
Service with the usual internally routable IP and DNS name. It will also create port 30050
on every cluster node and map it back to the ClusterIP
. ...