How to Access EdgeX Micro Services running on Kubernetes

Michaelestrin has done an excellent job of creating yaml files for deploying EdgeX on Kubernetes. However when we run Edgex on Kubernetes, we can no longer access the services as described in "https://docs.edgexfoundry.org/Ch-GettingStartedUsers.html".

We need to use either Kubernetes Ingress and Ingress controller or expose the port so that we can access the services from browser.  If  the device code is not running as Kubernetes PODs, it will not be able to connect to the Edgex platform either.

Step-by-step guide

1. Run below on the Kubernetes Master node to expose the services as Node port

kubectl expose deployment edgex-core-consul --type=NodePort --name=consulnodeport
kubectl expose deployment edgex-core-command --type=NodePort --name=commandnodeport
kubectl expose deployment edgex-core-data --type=NodePort --name=datanodeport
kubectl expose deployment edgex-core-metadata --type=NodePort --name=metadatanodeport
kubectl expose deployment edgex-support-rulesengine --type=NodePort --name=rulesenginenodeport
kubectl expose deployment edgex-support-logging --type=NodePort --name=loggingnodeport

 2. Run below on the Kubernetes Master node to get the Node ports

kubectl get svc | grep NodePort

Sample output

commandnodeport  NodePort 10.97.76.1       <none> 48082:32263/TCP 13d
consulnodeport       NodePort 10.96.153.108  <none> 8400:31618/TCP,8500:30101/TCP,8600:32426/TCP 13d
datanodeport          NodePort 10.103.180.82  <none> 48080:30995/TCP,5563:31584/TCP 13d
lognodeport            NodePort 10.102.64.0     <none>  48061:30202/TCP 13d
metanodeport         NodePort 10.106.226.49  <none> 48081:30378/TCP 13d
rulenodeport          NodePort  10.106.22.55    <none> 48075:32045/TCP


3. Once we get the port, replace the default port 8500,48080,48081 etc. with the corresponding node port.  For e.g., to access the Consul GUI, use the URL below

http://[host]:30101/ui

where 30101 is the nodeport corresponding to 8500

https://github.com/edgexfoundry-holding/edgex-kubernetes-support/tree/master/releases/edinburgh/kubernetes