Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 1.2 KB

21-Services-ClusterIP.md

File metadata and controls

43 lines (35 loc) · 1.2 KB

Kubernetes Services - ClusterIP

In this section we will take a look at services - ClusterIP in kubernetes

ClusterIP

  • In this case the service creates a Virtual IP inside the cluster to enable communication between different services such as a set of frontend servers to a set of backend servers.

    srvc1

What is a right way to establish connectivity between these services or tiers

  • A kubernetes service can help us group the pods together and provide a single interface to access the pod in a group.

    srvc2

To create a service of type ClusterIP

apiVersion: v1
kind: Service
metadata:
 name: back-end
spec:
 types: ClusterIP
 ports:
 - targetPort: 80
   port: 80
 selector:
   app: myapp
   type: back-end
$ kubectl create -f service-definition.yaml

To list the services

$ kubectl get services

srvc3

K8s Reference Docs: