Services
Services provide stable endpoints to access pods running in a cluster, thus exposing our applications to users online. They allow pods to die and replicate without interrupting access to the applications running in those pods. There are several types of services in Kubernetes. We will discuss three of them in detail: ClusterIP, NodePort, and load balancer.
ClusterIP Service
A ClusterIP service provides an IP address that is only accessible inside the cluster. This IP does not change for the lifetime of the service, providing a stable endpoint to access the pods. Here is an example ClusterIP service manifest:
service_clusterip.yaml
apiVersion: v1 kind: Service metadata: name: my-service spec: type: ClusterIP selector: app: my-app ports: - protocol: TCP port: 80 ...