Development workflow - Arthyon/microservice-poc GitHub Wiki

All commands are run from the root of the repository. For explanations of the various commands used in the workflow, see Workflow Explanations

Starting development:

Make sure your volume is correctly mounted. On Windows you will most likely need to check out Issues with volume mounting after every restart.

When Docker and Kubernetes starts, it should be up and running. If the volume mounting crashed (check using kubectl get pods and look for failed statuses), run kubectl delete pods --all and Kubernetes will recreate and restart all pods.

You should be able to access the services on http://localhost:30010 (or the port specified in values.dev.yaml under ingress.nodePort).

Changing a node-service without adding new dependencies to package.json:

  • Make your changes
  • kubectl delete pod -l app=<servicename>

Changing a node-service that adds a new dependency

  • Make your changes
  • docker build <path-to-dockerfile> -t microservices/<servicename>
  • helm upgrade --install develop -f Infrastructure/kubernetes/charts/default/values.dev.yaml -f Infrastructure/kubernetes/charts/default/local.yaml ./Infrastructure/kubernetes/charts/default/

Changing a .Net-service without adding new nuget-packages:

  • Make your changes
  • App will hot reload

Changing a .Net-service that adds new nuget-packages:

  • Make your changes
  • docker build <path-to-dockerfile> -t microservices/<servicename>
  • helm upgrade --install develop -f Infrastructure/kubernetes/charts/default/values.dev.yaml -f Infrastructure/kubernetes/charts/default/local.yaml ./Infrastructure/kubernetes/charts/default/

Adding a new service:

  • Add the new service
  • docker build <path-to-dockerfile> -t microservices/<servicename>
  • helm upgrade --install develop -f Infrastructure/kubernetes/charts/default/values.dev.yaml -f Infrastructure/kubernetes/charts/default/local.yaml ./Infrastructure/kubernetes/charts/default/

Accessing the Kubernetes Dashboard

  • Run kubectl proxy in a new terminal
  • Visit http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

if this doesn't work, the dashboard is not deployed.

To deploy the dashboard we need to:

  • Deploy the dashboard: kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
  • Create user to access the dashboard: kubectl create -f https://gist.githubusercontent.com/Arthyon/5163b64c12bb64fefe0768ee8f3751cf/raw/278fa1df759bc7bca508f85387bd31dc13c51fb8/k8s-admin-user
  • Get the token used to log in: kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')