Last active
February 27, 2020 13:38
-
-
Save weaming/a0423ca43b2038962be73cf70fbad2dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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