May 2018
Intermediate to advanced
554 pages
13h 51m
English
Microservices (my-calc) uses the Kubernetes deployment and service, but it needs to communicate to other pods only. In other words, there's no need to expose it to the outside Kubernetes network. Therefore, the service type is set as ClusterIP:
$ cat my-calc.yaml apiVersion: apps/v1kind: Deploymentmetadata: name: my-calc-deployspec: replicas: 2 selector: matchLabels: run: my-calc template: metadata: labels: run: my-calc spec: containers: - name: my-calc image: hidetosaito/my-calc---apiVersion: v1kind: Servicemetadata: name: my-calc-servicespec: ports: - protocol: TCP port: 5000 type: ClusterIP selector: run: my-calc
Use the kubectl command to load the my-calc pods as follows:
$ kubectl create -f my-calc.yaml deployment.apps ...
Read now
Unlock full access