Kab lus no xaus cov ntawv txhais lus ntawm OpenWhisk los ntawm tus sau Priti Desai. Niaj hnub no peb yuav saib cov txheej txheem ntawm kev xa tawm OpenWhisk hla Kubernetes nrog cov lus raug kho kom ua haujlwm nrog cov ntawv thov tam sim no. Nws tseem yuav npog cov txheej txheem ntawm kev khiav haujlwm OpenWhisk siv Knative thiab TektonCD ntawm Kubernetes siv Nodejs runtime.
Deploying OpenWhisk ntawm Kubernetes
Ob peb hnub dhau los, kuv tau sim siv OpenWhisk rau Kubernetes los tsim qhov chaw sim yooj yim thiab nrawm. Thiab txij li thaum kuv yog tus tshiab rau Kubernetes, kuv ntseeg tias ib hnub thiab ib nrab tau siv rau kev xa mus ua tiav. IN qhov no Cov chaw khaws cia muaj cov lus qhia meej heev rau kev xa tawm OpenWhisk ntawm Kubernetes. Nov yog cov lus qhia xa mus rau Mac (Kuv kuj yuav ua txhua yam ntawm Linux vim kuv nyiam Linux. - kwv yees. tus txhais lus).
Txhim kho tus neeg saib xyuas pob asdf, tom qab uas peb tau kho ~/.bash_profile los yog nws sib npaug zoo li no:
[Ib zaug ntxiv, hla cov kauj ruam no ntawm Linux. - kwv yees. tus txhais lus]
Nruab minikube thiab kubelet:
$ asdf install kubectl 1.9.0
$ asdf global kubectl 1.9.0
$ asdf install minikube 0.25.2
$ asdf global minikube 0.25.2
[cov versions tshwj xeeb tau teeb tsa, tab sis kuv tau tshawb xyuas txhua yam ntawm cov ntawv tshiab muaj nyob rau Linux; Kuv xav tias koj tuaj yeem ruaj ntseg nruab qhov tseeb. - kwv yees. tus txhais lus]
Ntawm Linux, cov kauj ruam no tau ua ib yam dab tsi zoo li no (txhua yam yog muab tso rau hauv ~ / bin, uas tau teev nyob rau hauv kuv PATH, tus txhais lus ceeb toom):
$ wsk property set --apihost 192.168.99.100:31001
$ wsk property set --auth 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
Peb tshawb xyuas:
$ wsk -i list
Entities in namespace: default
packages
actions
triggers
rules
Teeb meem thiab lawv cov kev daws teeb meem
getsockopt: kev twb kev txuas tsis kam
$ wsk -i list
error: Unable to obtain the list of entities for namespace 'default': Get http://192.168.99.100:31001/api/v1/namespaces/_/actions?limit=0&skip=0: dial tcp 192.168.99.100:31001: getsockopt: connection refused
Peb siv cov ntaub ntawv tam sim no rau cov ntaub ntawv no:
$ sed 's/${DOCKER_USERNAME}/'"$DOCKER_USERNAME"'/' -i taskrun.yaml
Peb thov:
$ kubectl apply -f taskrun.yaml
pipelineresource.tekton.dev/openwhisk-nodejs-runtime-git created
pipelineresource.tekton.dev/openwhisk-nodejs-helloworld-image created
taskrun.tekton.dev/openwhisk-nodejs-helloworld created
Kev tshuaj xyuas cov haujlwm muaj xws li tau txais lub pod lub npe thiab saib nws cov xwm txheej. Koj tuaj yeem saib daim ntawv ua tiav ntawm txhua kauj ruam, piv txwv li:
$ kubectl get taskrun
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
openwhisk-nodejs-helloworld True Succeeded 5m15s 44s
$ kubectl get pod openwhisk-nodejs-helloworld-pod-4640d3
NAME READY STATUS RESTARTS AGE
openwhisk-nodejs-helloworld-pod-4640d3 0/6 Completed 0 5m20s
$ kubectl logs openwhisk-nodejs-helloworld-pod-4640d3 -c step-git-source-openwhisk-nodejs-runtime-git-r8vhr
{"level":"info","ts":1576532931.5880227,"logger":"fallback-logger","caller":"logging/config.go:69","msg":"Fetch GitHub commit ID from kodata failed: open /var/run/ko/refs/heads/master: no such file or directory"}
{"level":"info","ts":1576532936.538926,"logger":"fallback-logger","caller":"git/git.go:81","msg":"Successfully cloned https://github.com/apache/openwhisk-runtime-nodejs.git @ master in path /workspace/runtime-git"}
{"level":"warn","ts":1576532936.5395331,"logger":"fallback-logger","caller":"git/git.go:128","msg":"Unexpected error: creating symlink: symlink /tekton/home/.ssh /root/.ssh: file exists"}
{"level":"info","ts":1576532936.8202565,"logger":"fallback-logger","caller":"git/git.go:109","msg":"Successfully initialized and updated submodules in path /workspace/runtime-git"}
Tom qab ua tiav, peb yuav muaj cov duab hauv Registry uas tuaj yeem siv tau siv cov khoom siv kn, tsim los ua haujlwm nrog Knative cov kev pabcuam, piv txwv li:
kn service create nodejs-helloworld --image docker.io/${DOCKER_USERNAME}/openwhisk-nodejs-helloworld
Service 'nodejs-helloworld' successfully created in namespace 'default'.
Waiting for service 'nodejs-helloworld' to become ready ... OK
Service URL:
http://nodejs-helloworld.default.example.com