Skip to content

nayanbhagowaty/Microservices.NET6

Repository files navigation

Solution Architect

Covered

  1. Docker
  2. Kubernates
  3. Event Bus using RabbitMQ
  4. gRPC

Pending

  1. Service discovery
  2. Handle Null connection

Execution

  1. Build image from the folder with dockerfile :
docker build -t nayan112/platformservice .
  1. Run the image: (disabled https redirection & swagger is enabled in dev only)
docker run -p 8080:80 -d nayan112/platformservice

  1. push the image :
docker push nayan112/platformservice
  1. Check id kubernetis is running with version:
kubectl version
  1. Navigate to the folder K8S and deploy platform service & related cluster ip:
kubectl apply -f platforms-deployment.yaml
  1. Check deployments: (need to push the image to docker hub first if missed)
kubectl get deployments
kubectl get pods
  1. delete deployment related to platform service:
kubectl delete deployment platform-deployment 
  1. Start services to enable access through node port:
kubectl apply -f platforms-np-srv.yaml
  1. Check services:
kubectl get services
  1. Get the external port of nodeport to connect to the pod
  2. Refresh deployment/docker image:
kubectl rollout restart deployment <depoyment_name>
  1. To view pods running from all namespaces: (default is application namespace):
kubectl get namespaces 
kubectl get deployments --namespace=ingress-nginx 
kubectl get services --namespace=ingress-nginx
  1. Configuration of Ingress Nginx container & Ingress Nginx load balancer:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.2/deploy/static/provider/cloud/deploy.yaml
  1. Deploy ingress service so that application can be accessed from outside:
kubectl apply -f ingress-srv.yaml  
  1. Ingress service needs a host name. Localhost doesn't work. So create an entry in host file similar to hostname in deployment file.
  2. Create persistent view claim for MSSQL:
kubectl apply -f local-pvc.yaml
  1. Verify the claim:
kubectl get pvc 
kubectl get storageclass
  1. Create a secret for db password:
kubectl create secret generic mssql --from-literal=SA_PASSWORD="r00t.R00T"  
  1. Deploy mssql: check status with pods & deployments (ImagePullBackOff is a common error)
kubectl apply -f mssql-platform-deployment.yaml
  1. Setup of DB migration (not part of execution): run ef migration. Need to disable in memory db & set db connection string)
dotnet ef migrations add initialmigration
  1. Deploy rabbitmq queue manager & management portal, load balancer & cluster ip: (verify at http://localhost:15672)
kubectl apply -f rabbitmq-deployment.yaml
  1. gRPC setup done without https, needed in the server (platformservice) -- check kestrel config in prod configs

Help

  1. Editing code in VSCode: Navigate to the particular project and type
code -r <foldername>
  1. Formatting in VS CODE :
Alt + Shift + F

Errors

  1. Swagger fails to load : Fix: decoreate api methods with REST method decorators, HTTPGET, HTTPPUT
  2. GetPlatformById method doesnt hit breakpoint/Swagger doesn't hit the method: Duplicate method if query string is not recognized. Set decorator as HTTPGET("Id=id")
  3. Converting YAML to JSON: yaml: line 4: found character that cannot start any token: Yaml is CRAZY.. use spaces instead of tab
  4. NodePort not working: Verify name in selector-> app & service deployment file (eg. in platforms-deployment.yaml & platforms-np-srv.yaml)
  5. http port is not accessible: System restart or try changing the port no.
  6. ImagePullBackOff : no network, no image, wrong image path
  7. mssql image deployment error: port 1433 in host machine in use, password policy not in complience

Enabling & using local dashboard: Remote- coming..

  1. Deploy dashboard:
kubectl apply -f dashboard.yaml
  1. Deploy an admin user:
kubectl apply -f dashboard-adminuser.yaml
  1. Get the token:
kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}"
  1. Run the dashboard proxy:
kubectl proxy 
  1. Application is available Application
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
  1. Remove the admin ServiceAccount and ClusterRoleBinding.
kubectl -n kubernetes-dashboard delete serviceaccount admin-user
kubectl -n kubernetes-dashboard delete clusterrolebinding admin-user
Video link

    https://www.youtube.com/watch?v=DgVjEo3OGBI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published