Microservice

Devops

  • The developed service image is created. In my example I created this image by dockerfile.
docker image build -t example-task .
  • This image is tagged/versioned and pushed to an image hub. I used docker hub.
docker tag example-task:v1.0.0 thiyya/example-task:latest
docker push thiyya/example-task:latest
minikube start
  • A yml file is created for the deployment. In this yml, there are many definitions such as the name of the service, number of replicas, access, network, from which image it will be generated, how it will be exposed.
  • You can see the deployment.yaml I created for this example.
kubectl apply -f deployment.yaml
  • I created the greetings service on Minikube and made it ready for use.
kubectl get pods -o=wide
NAME                               READY   STATUS    RESTARTS   AGE     IP           NODE       NOMINATED NODE   READINESS GATES
firstdeployment-7d5b676748-lqdjn   1/1     Running   0          4m36s   172.17.0.3   minikube   <none>           <none>
  • I created a service.yaml to create network to the greeting service. You can see the service.yaml I created for this example
kubectl get service
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
backend      NodePort    10.96.148.165   <none>        8080:32250/TCP   9s
  • Minikube provides a service to open a tunnel to nodeport. To do this :
minikube service --url backend
http://127.0.0.1:65066
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
  • Now you can use this url to access the greeting service img.png