Setup Kubernetes to tracing log in local

Setup Kubernetes to tracing log in local

March 15, 2020 1 By Nam Vu

Trace log server

  • Setup Kubernetes and start kube
  • Setup path in environment to path .kube folder (Ex: C:\Users\namvut\.kube)
  • Update config file with content server:
			apiVersion: v1
			clusters:
			- cluster:
				certificate-authority-data: <Your credential>
				server: <Link server>
			  name: aks-01
			contexts:
			- context:
				cluster: aks-01
				user: clusterUser_staging_aks-01
			  name: aks-01
			current-context: aks-01
			kind: Config
			preferences: {}
			users:
			- name: clusterUser_staging_aks-01
			  user:
				client-certificate-data: <Your credential>
				client-key-data: <Your client key>
				token: <Your token>
  • Test kubectl via command line:
    kubectl get node
  • Get all container service via command line:
    kubectl get pod -n dev
    kubectl get po -n dev
  • Install octant by choco via command line:
    choco install octant
  • Start octant via command line:
    octant
  • Access octant to http://127.0.0.1:7777/#/ 
  • Select environment dev and go to your service or center logging req service
  • Go to pod page and using Start Port Forward in Container seq to forward logging localhost
  • Go to link forward to trace logging
  • To update setting of logging configuration:
    • Get source context (Ex: “SourceContext”: “Microsoft.AspNetCore.Server.Kestrel”)
    • Add to MinimumLevel > Override in appsetting.json of your service.
      Ex:
               "MinimumLevel": {
		  "Default": "Debug",
		  "Override": {
			"Microsoft": "Warning",
			"System": "Warning",
			"Microsoft.Hosting.Lifetime": "Information",
			"Microsoft.EntityFrameworkCore": "Debug",
			"HotChocolate": "Error"
		  }
		}