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       <none> 48082:32263/TCP 13d
consulnodeport       NodePort  <none> 8400:31618/TCP,8500:30101/TCP,8600:32426/TCP 13d
datanodeport          NodePort  <none> 48080:30995/TCP,5563:31584/TCP 13d
lognodeport            NodePort     <none>  48061:30202/TCP 13d
metanodeport         NodePort  <none> 48081:30378/TCP 13d
rulenodeport          NodePort    <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


where 30101 is the nodeport corresponding to 8500