openfaas / faasd

A lightweight & portable faas engine
https://store.openfaas.com/l/serverless-for-everyone-else
Other
3.01k stars 214 forks source link

Accessing faasd components from outside the VM #33

Closed prateekgogia closed 4 years ago

prateekgogia commented 4 years ago

I just started playing with faasd, and was able to install faasd. However, can't access the Prometheus gateway or perform any other operation inside the VM. Is there a way to be to access the private IPs from outside the VM. Like Docker allows port-mapping, is there anything similar available?

Expected Behaviour

Trying to figure out if there is a way to be able to access private IPs from outside the Ubuntu VM on Mac.

http://[prometheus_ip]:9090/targets

Current Behaviour

Possible Solution

Steps to Reproduce (for bugs)

Context

journalctl -u faasd -f
-- Logs begin at Wed 2019-08-07 18:19:05 UTC. --
Jan 29 06:33:02 ubuntu faasd[25004]: Connect: nats://nats:4222
Jan 29 06:33:02 ubuntu faasd[25004]: Subscribing to: faas-request at nats://nats:4222
Jan 29 06:33:02 ubuntu faasd[25004]: Wait for  5m5s
Jan 29 06:33:02 ubuntu faasd[25004]: [1] 2020/01/29 06:33:02.336483 [INF] STREAM: Channel "faas-request" has been created
Jan 29 06:33:02 ubuntu faasd[25004]: Listening on [faas-request], clientID=[faas-worker-ubuntu], qgroup=[faas] durable=[]
Jan 29 06:33:05 ubuntu faasd[25004]: 2020/01/29 06:33:05 [up] Sending 10.62.0.5 to proxy
Jan 29 06:33:05 ubuntu faasd[25004]: 2020/01/29 06:33:05 Starting faasd proxy on 8080
Jan 29 06:33:05 ubuntu faasd[25004]: Gateway: 10.62.0.5:8080
Jan 29 06:33:05 ubuntu faasd[25004]: 2020/01/29 06:33:05 [proxy] Wait for done
Jan 29 06:33:05 ubuntu faasd[25004]: 2020/01/29 06:33:05 [proxy] Begin listen on 8080

Your Environment

go version
go version go1.13.4

containerd -version

containerd github.com/containerd/containerd v1.3.2 ff48f57fc83a8c44cf4ad5d672424a98ba37ded6

uname -a
Linux ubuntu 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release

NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
prateekgogia commented 4 years ago

Also, not sure if this is the expected behavior: 192.168.56.102 is the VMs IP

root@ubuntu:# export IP=192.168.56.102
root@ubuntu:# export OPENFAAS_URL=http://$IP:8080
root@ubuntu:# cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s
Calling the OpenFaaS server to validate the credentials...
WARNING! Communication is not secure, please consider using HTTPS. Letsencrypt.org offers free SSL/TLS certificates.
Server returned unexpected status code: 404 - 404 page not found

root@ubuntu:# export IP=localhost
root@ubuntu:# export OPENFAAS_URL=http://$IP:8080
root@ubuntu:# cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s
Calling the OpenFaaS server to validate the credentials...
WARNING! Communication is not secure, please consider using HTTPS. Letsencrypt.org offers free SSL/TLS certificates.
credentials saved for admin http://localhost:8080
root@ubuntu:/media/sf_workspace/golang/src/github.com/alexellis/faasd#
alexellis commented 4 years ago

Please feel free to ask questions on Slack for technical support. #openfaas or #contributors will make a good fit.