the recent explosion in popularity of container technology (Docker in particular) and in orchestration technology (such as Kubernetes, Mesos, Consul and so on) this pattern has become much more viable to implement from a technical standpoint.kubectl is like git cli, you run kubernetes commands through it docshelm (and tiller) is like git's aliases (and more), you can chain kubectl commandsminikube is a local dev server equivalent in kubernetes
GKE is Google Kubernetes Engine, for production, run through gcloud clikubeless is a serverless framework for kubernetesserverless computing == containerized computing == smaller units == faster, space saving To get started with serverless computing, you only need three ingredients:
minikube start if error, might be trouble with your VMkubectl cluster-info to see where your server iskubectl get nodes to see all your containers in the cluster (running apps on your virtual OS)kubectl describe node to see detailsbrew install kubernetes-helmhelm install stable/mongodb to install locally with no connection to the outside worldhelm install stable/mongodb --set serviceType=NodePortkubectl proxy to start hosting to the outside worldlocalhost:8001 and see endpointsminikube dashboard to see dashboard docsRELEASEexport RELEASE=$(curl -s https://api.github.com/repos/kubeless/kubeless/releases/latest | grep tag_name | cut -d '"' -f 4)kubectl create ns kubelesskubectl create -f https://github.com/kubeless/kubeless/releases/download/$RELEASE/ + yaml_optionkubeless-$RELEASE.yaml is used for RBAC Kubernetes cluster. (minikube - if you get stuff with kubectl clusterroles then it's RBAC)kubeless-non-rbac-$RELEASE.yaml is used for non-RBAC Kubernetes cluster.kubeless-openshift-$RELEASE.yaml is used to deploy Kubeless to OpenShift (1.5+).export RELEASE=$(curl -s https://api.github.com/repos/kubeless/kubeless/releases/latest | grep tag_name | cut -d '"' -f 4)kubectl create ns kubelesskubectl create -f https://github.com/kubeless/kubeless/releases/download/$RELEASE/kubeless-$RELEASE.yaml // for kubernetes cluster on GKEkubectl get pods -n kubelesskubectl get deployment -n kubelesskubectl get customresourcedefinitionfunction on your kubernetes cluster (how)# your function
def hello(event, context):
print event
return event['data']kubeless function deploy function-name --runtime python2.7 --from-file test.py --handler test.hellokubeless function call function-name --data 'hello world finally!!'kubeless ui the equivalent of postman for kubelesskubectl create -f https://raw.githubusercontent.com/kubeless/kubeless-ui/master/k8s.yamlyarn run dev to startfunction (essentially an app now) to a http endpoint (one of the ways) docsminikube addons enable ingress - enables default ingress (Nginx Ingress controller)kubectl get pod -n kube-system -l app=nginx-ingress-controller (might need to wait a while)kubectl get pods to see if your function is up and runningkubectl get svc to get all services in your kubernetes clusterkubeless trigger http list to check for existing http triggerskubeless trigger http create test-endpoint --function-name function-name where test-endpoint is the endpoint name and function-name is the kubeless function that is deployedkubectl get ing shows you where it is hostedfunction-name.192.168.99.100.nip.iocurl --data 'hello world super freaking finally!' --header "Host: test-endpoint.192.168.99.100.nip.io" --header "Content-Type:text/html" 192.168.99.100/echo (didn't work for me) TODO to be continued later
curl --data 'hello world super freaking finally!' --header "Host: test-endpoint.192.168.99.100.nip.io" --header "Content-Type:text/html http://192.168.99.100:31106/kubectl proxy to start opening a localhost connection between the minikube cluster and the pckubeless ui app (i only used the github clone -> yarn install -> yarn dev)kubectl proxy docskubectl proxy to start hosting to the outside worldlocalhost:8001 and see endpointsminikube dashboard to see dashboard docsMBP17079:~ li_qun_tang$ helm install stable/mongodb
NAME: sullen-mole
LAST DEPLOYED: Wed May 16 20:22:32 2018
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Secret
NAME TYPE DATA AGE
sullen-mole-mongodb Opaque 1 0s
==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
sullen-mole-mongodb Bound pvc-6d259685-58fb-11e8-a566-080027cecb76 8Gi RWO standard 0s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
sullen-mole-mongodb ClusterIP 10.101.7.183 <none> 27017/TCP 0s
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
sullen-mole-mongodb 1 1 1 0 0s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
sullen-mole-mongodb-74f8b689f9-5k2pt 0/1 ContainerCreating 0 0s
NOTES:
** Please be patient while the chart is being deployed **
MongoDB can be accessed via port 27017 on the following DNS name from within your cluster:
sullen-mole-mongodb.default.svc.cluster.local
To get the root password run:
export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace default sullen-mole-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
To connect to your database run the following command:
kubectl run sullen-mole-mongodb-client --rm --tty -i --image bitnami/mongodb --command -- mongo --host sullen-mole-mongodb -p $MONGODB_ROOT_PASSWORD
To connect to your database from outside the cluster execute the following commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app=mongodb" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward --namespace default $POD_NAME 27017:27017 &
mongo --host 127.0.0.1 -p $MONGODB_ROOT_PASSWORD