Skip to content

Instantly share code, notes, and snippets.

@weaming
Last active February 27, 2020 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaming/a0423ca43b2038962be73cf70fbad2dc to your computer and use it in GitHub Desktop.
Save weaming/a0423ca43b2038962be73cf70fbad2dc to your computer and use it in GitHub Desktop.
apt-get update; apt-get install -y curl wget unzip
curl -sfL https://get.k3s.io | sh -
kubectl create ns kubeless
kubectl create -f https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless-v1.0.6.yaml
wget https://github.com/kubeless/kubeless/releases/download/v1.0.6/kubeless_linux-amd64.zip -O kubeless.zip; \
unzip kubeless.zip; \
mv bundles/kubeless_linux-amd64/kubeless /usr/local/bin; \
rm -rf bundles/ kubeless.zip
mkdir ~/.kube/; kubectl config view --flatten --minify > ~/.kube/config
cat > test.py << EOF
def hello(event, context):
print(event)
return event['data']
EOF
kubeless function deploy hello \
--runtime python2.7 \
--from-file test.py \
--handler test.hello
kubectl get functions
kubeless function ls
kubeless function call hello --data 'Hello world!'
# or
kubectl proxy -p 8080 &
curl -L --data '{"Another": "Echo"}' \
--header "Content-Type:application/json" \
localhost:8080/api/v1/namespaces/default/services/hello:http-function-port/proxy/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment