Deploying on the Kubernetes cluster
We begin the process of deploying our software on the Kubernetes cluster by defining a service. As you remember from Chapter 7, Introduction to Kubernetes, services abstract a set of Pods as a single IP and port, allow simple TCP/UDP load, and allow the list of Pods to change dynamically. Let's start with service creation.
Creating a service
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: v1 kind: Service metadata: name: rest-example labels: app: rest-example tier: backend spec: ...