- Take me to Video Tutorial
In this section we will take a look at services
in kubernetes
-
Kubernetes Services enables communication between various components within and outside of the application.
-
How do we as an
external user
access theweb page
?
-
NodePort
- Where the service makes an internal POD accessible on a POD on the NODE.
apiVersion: v1 kind: Service metadata: name: myapp-service spec: types: NodePort ports: - targetPort: 80 port: 80 nodePort: 30008
apiVersion: v1 kind: Service metadata: name: myapp-service spec: type: NodePort ports: - targetPort: 80 port: 80 nodePort: 30008 selector: app: myapp type: front-end
$ kubectl create -f service-definition.yaml
$ kubectl get services
$ curl http://192.168.1.2:30008
- Where the service makes an internal POD accessible on a POD on the NODE.
-
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.
- In this case the service creates a
-
LoadBalancer
- Where the service provisions a
loadbalancer
for our application in supported cloud providers.
- Where the service provisions a
K8s Reference Docs: