Comments (7)
I haven't seen anything in your issue that makes it seem like OpenFaaS or K8s wouldn't work in a devcontainer specifically. I think a better title for this issue would be: "How do I use a local registry with OpenFaaS?"
There are some instructions that were contributed based upon a KinD (not an OpenFaaS) guide on how to use a registry on the same machine - https://docs.openfaas.com/tutorials/local-kind-registry/
Setting up a registry on localhost is a bit advanced, perhaps you'd prefer to use a short-lived registry instead like ttl.sh?
We use it a lot for local development and testing.
I'll get this closed, and let us know how you get on with ttl.sh or the KinD project's instructions for local registries.
Alex
from faas.
Delete everything that you have and only run the commands from the tutorial. The port is 5001 and you need to use localhost not the IP.
from faas.
No problem.
If you'd like to help support the time we spend maintaining OpenFaaS and supporting users via GitHub, please consider setting up a GitHub Sponsorship with a set or custom tier. We want the Community Edition to continue to be available for free users 🙂
https://github.com/sponsors/openfaas/
from faas.
Okay, I am now reasonably certain that the problems I am encountering are because I haven't set up a self-signed certificate.
It still seems weird to me that I was able to push the image to the registry without issue, but retrieving it is the problem.
For those following along at home, we are here:
devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/typescript-node
{
"name": "Existing Dockerfile",
"build": {
"context": "../docker/",
"dockerfile": "../docker/Dockerfile"
},
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"ms-vscode-remote.remote-containers",
"streetsidesoftware.code-spell-checker",
"unifiedjs.vscode-mdx"
]
}
},
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "latest",
"moby": true
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none",
"version": "latest"
}
},
"forwardPorts": [8080],
"postCreateCommand": "/entrypoint.sh",
"runArgs": ["--network=host"]
}
Dockerfile
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/devcontainers/base:ubuntu
ENV container=docker
ENV OPENFAAS_URL=http://localhost:8080
RUN sudo apt-get update > /dev/null \
# Node.js
&& wget -qO- https://deb.nodesource.com/setup_lts.x | sudo sh \
# Common
&& sudo apt-get install -y file nodejs \
# Arkade
&& curl -fsSL https://get.arkade.dev | sudo sh
COPY --chmod=755 ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh
#!/bin/sh
# kind
arkade get kind
sudo mv ~/.arkade/bin/kind /usr/local/bin/
kind delete cluster
docker container rm --force "$(docker ps --filter name="kind-" --all --quiet)"
docker run -d --restart=always -p 127.0.0.1:5000:5000 --name "kind-registry" registry:2
sed "s/\t/ /g" <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
endpoint = ["http://kind-registry:5000"]
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 31112
hostPort: 8080
EOF
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "kind-registry")" = 'null' ]; then
docker network connect "kind" "kind-registry"
fi
sed "s/\t/ /g" <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
name: local-registry-hosting
namespace: kube-public
data:
localRegistryHosting.v1: |
host: "localhost:5000"
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF
# OpenFaaS
arkade install openfaas
kubectl rollout status -n openfaas deploy
# faas-cli
arkade get faas-cli
sudo mv ~/.arkade/bin/faas-cli /usr/local/bin/
PASSWORD=$(kubectl get secret -n openfaas basic-auth -o jsonpath="{.data.basic-auth-password}" | base64 --decode; echo)
echo -n "$PASSWORD" | faas-cli login --username admin --password-stdin
npm install
npm run faas
echo "> Listening on http://admin:$PASSWORD@localhost:8080/"
There's something wrong with the volume mount currently. It's getting mounted as an empty folder.
from faas.
I had absolutely no issues running KinD and OpenFaaS in a devcontainer, and by following the tutorial in the openfaas docs (referenced above), I was also able to use a local registry.
Let me know if this helped 🙂
from faas.
Hey Alex, I hugely appreciate you taking a look.
You were able to get everything working just by following the KinD guide?
You didn't have to do anything extra with htaccess
, certificates, or setting imagePullSecrets
?
Weird that I've been running into so many issues. I'll start again from scratch and see if I can make sense of how I got here.
Thanks!
from faas.
It worked 🤦♂️
I've updated my previous comment to reflect what worked in the end.
Basically I thought myself smarter than the tutorial and thought I could expose the registry on the host and then get rid of what I had thought would be unnecessary redirection.
Rest assured I feel very silly now 🙂
from faas.
Related Issues (20)
- Is Docker Swarm supported? HOT 1
- Cannot connect to OpenFaaS on URL: http://xx.xxxx:31112 HOT 1
- Request for CUDA access HOT 4
- how OpenFaaS handles concurrent requests in the function? HOT 1
- Function execution is not stateless HOT 2
- Can multiple functions be run on a single runtime? HOT 1
- Question: Import path for common modules HOT 2
- requests schedule policy in openfaas HOT 1
- Is there a workflow tool for OpenFaaS? HOT 3
- some companies appear twice in the adopters list HOT 2
- Support Azure service bus topic/subscription HOT 1
- RPC and openfaas HOT 1
- Question about OpenAPI Spec 3.1 HOT 2
- [Improvement] OpenFaaS operator installation
- The README.md under fass/api-docs has an incorrect URL to the api spec file
- Setup repository locally
- Function failed to deploy with status code: 500 HOT 2
- Openfaas install gateway Crash HOT 2
- Consultation on the usage permissions of the community version
- Unable to log in to the gateway - connection refused HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faas.