By default, each Pod is only accessible by its internal IP address within the Kubernetes cluster. To make the container accessible from outside the Kubernetes virtual network, we need to expose the Pod as a Kubernetes Service. To create a service, we are going to use the simple .yaml file, with a service manifest. YAML is a human-readable data serialization language, which is commonly used for configuration files. A sample service manifest for our Java rest-example could look the same as the following:
apiVersion: v1kind: Servicemetadata: name: rest-example labels: app: rest-example tier: backendspec: type: NodePort ports: - port: 8080 selector: app: rest-example tier: backend
Note that the manifest of a service doesn't ...