apache / openwhisk-deploy-kube

The Apache OpenWhisk Kubernetes Deployment repository supports deploying the Apache OpenWhisk system on Kubernetes and OpenShift clusters.
https://openwhisk.apache.org/
Apache License 2.0
300 stars 231 forks source link

"wsk api list" is not working #104

Closed Terry-Shi closed 5 years ago

Terry-Shi commented 6 years ago

I already created an java action, and it's ok to call it from command line. now I'm trying ApiGateway, but I got below error msg:

./wsk api list error: Unable to obtain the API list: The requested resource does not exist. (code 22528)

I checked log of controller

[2017-12-01T09:06:06.755Z] [INFO] [#tid_22154] [CouchDbRestStore] [GET] 'test_whisks', document: 'id: whisk.system/apimgmt/getApi'; not found. [marker:database_getDocument_finish:34:3]
[2017-12-01T09:06:06.756Z] [INFO] [#tid_22154] [WhiskActionMetaData] invalidating CacheKey(whisk.system/apimgmt/getApi)
[2017-12-01T09:06:06.756Z] [INFO] [#tid_22154] [BasicHttpService] [marker:http_get.404_count:35:35]

I guess something is missing in couchDB, but I don't know how to fix it .

rabbah commented 6 years ago

You didn’t deploy the api gw integration

dgrove-oss commented 6 years ago

This is a missing step in the current install instructions for kube. See #79

saurabh1284 commented 5 years ago

I had recently cloned and deployed it, but still hitting the same issue-->

wsk api list -i

error: Unable to obtain the API list: The requested resource does not exist. (code Nd1CfSqDwmJWBS5gMMuwDoezNM0tO23E)

wsk action list -i

actions /whisk.system/hello private nodejs:6 /whisk.system/helloweb private nodejs:6 /whisk.system/hellopython private python:2 /whisk.system/greeting private nodejs:6 /whisk.system/invokerHealthTestAction0 private

kubectl get pods -n openwhisk

NAME READY STATUS RESTARTS AGE apigateway-585d644b97-tprwb 1/1 Running 0 6d controller-0 1/1 Running 0 6d couchdb-7b5bb9657b-7d5mw 1/1 Running 0 6d init-couchdb-nc86p 0/1 Completed 0 6d invoker-gdl5k 1/1 Running 0 6d kafka-0 1/1 Running 0 6d nginx-9d9d8c7b-s2xvj 1/1 Running 0 6d redis-6c7657dbcb-x4wcl 1/1 Running 0 6d zookeeper-0 1/1 Running 0 6d

kubectl get svc -n openwhisk

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE apigateway ClusterIP 10.233.2.198 8080/TCP,9000/TCP 6d controller ClusterIP 10.233.37.215 8080/TCP 6d couchdb ClusterIP 10.233.27.3 5984/TCP 6d kafka ClusterIP 10.233.46.150 9092/TCP 6d nginx NodePort 10.233.37.34 80:30221/TCP,443:31001/TCP,8443:30587/TCP 6d redis ClusterIP 10.233.5.47 6379/TCP 6d zookeeper ClusterIP None 2181/TCP,2888/TCP,3888/TCP 6d

Any comments / workarounds ??

dgrove-oss commented 5 years ago

It looks like the job (or jobs depending on how recently you cloned the repo) that install the openwhisk catalog and the actions that support apigateway into the /whisk.system namespace either failed or did not run. See if you can find the logs/status for all the Jobs in your version of the Helm chart.

If the install jobs ran correctly, when you do wsk -i packages list /whisk.system you should see a listing of some standard packages like:

daves-mbp:incubator-openwhisk-deploy-kube dgrove$ wsk -i --auth `kubectl -n openwhisk get secret whisk.auth -o jsonpath='{.data.system}' | base64 --decode` package list
packages
/whisk.system/watson-speechToText                                      shared
/whisk.system/github                                                   shared
/whisk.system/websocket                                                shared
/whisk.system/samples                                                  shared
/whisk.system/slack                                                    shared
/whisk.system/watson-textToSpeech                                      shared
/whisk.system/weather                                                  shared
/whisk.system/utils                                                    shared
/whisk.system/combinators                                              shared
/whisk.system/apimgmt                                                  private

and you should be able to list the three actions in the /whisk.system/apimgmt package.

daves-mbp:incubator-openwhisk-deploy-kube dgrove$ wsk -i --auth `kubectl -n openwhisk get secret whisk.auth -o jsonpath='{.data.system}' | base64 --decode` action list /whisk.system/apimgmt
actions
/whisk.system/apimgmt/deleteApi                                        private nodejs:6
/whisk.system/apimgmt/createApi                                        private nodejs:6
/whisk.system/apimgmt/getApi                                           private nodejs:6
saurabh1284 commented 5 years ago

@dgrove-oss , I tried fresh installation and same issue persist.

-> wsk api list -i error: Unable to obtain the API list: The requested resource does not exist. (code la73Z5TZ4osyPHOtPpEeoTkpsub8b6Y7)

-> wsk package list -i packages

-> kubectl -n openwhisk get pods NAME READY STATUS RESTARTS AGE apigateway-64c68bd4fc-t4tmd 1/1 Running 0 18h controller-0 1/1 Running 0 18h couchdb-57cc5bd99d-7xscl 1/1 Running 0 18h init-couchdb-crbw6 0/1 Completed 0 18h install-packages-29rjb 0/1 Error 0 17h install-packages-694md 0/1 Error 0 17h install-packages-942hh 0/1 Error 0 18h install-packages-cqj6q 0/1 Error 0 18h install-packages-dg9dw 0/1 Error 0 17h install-packages-grkb9 0/1 Error 0 18h install-packages-hdl9t 0/1 Error 0 17h install-packages-q5z62 0/1 Error 0 17h install-packages-qlsnp 0/1 Error 0 17h install-packages-rvb9j 0/1 Error 0 17h install-packages-srbvt 0/1 Error 0 17h install-packages-vdt6t 0/1 Error 0 17h install-packages-xkrt7 0/1 Error 0 17h invoker-rbt5m 1/1 Running 0 18h invoker-wcnrd 1/1 Running 0 18h kafka-0 1/1 Running 0 18h nginx-5f8d4485c-zqxr8 1/1 Running 0 18h redis-7dfd894549-qmnlb 1/1 Running 0 18h zookeeper-0 1/1 Running 0 18h

-> kubectl -n openwhisk describe po install-packages-dg9dw Name: install-packages-dg9dw Namespace: openwhisk Node: mumfaasworker03/100.70.245.76 Start Time: Mon, 17 Dec 2018 13:36:48 +0000 Labels: app=owdev-openwhisk chart=openwhisk-0.1.1 controller-uid=dccbfeef-01fe-11e9-bc0a-fa163eed5476 heritage=Tiller job-name=install-packages name=install-packages release=owdev Annotations: Status: Failed IP: 10.233.68.23 Controlled By: Job/install-packages Init Containers: wait-for-healthy-invoker: Container ID: docker://0ec46d5fbfe03e25b9a2f609e268613fe2837d9355a31563b2612703fbea0535 Image: busybox Image ID: docker-pullable://busybox@sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812 Port: Host Port: Command: sh -c echo 0 > /tmp/count.txt; while true; do echo 'waiting for healthy invoker'; wget -T 5 -qO /tmp/count.txt --no-check-certificate "$READINESS_URL"; NUM_HEALTHY_INVOKERS=$(cat /tmp/count.txt); if [ $NUM_HEALTHY_INVOKERS -gt 0 ]; then echo "Success: there are $NUM_HEALTHY_INVOKERS healthy invokers"; break; fi; echo '...not ready yet; sleeping 3 seconds before retry'; sleep 3; done; State: Terminated Reason: Completed Exit Code: 0 Started: Mon, 17 Dec 2018 13:36:59 +0000 Finished: Mon, 17 Dec 2018 13:36:59 +0000 Ready: True Restart Count: 0 Environment: READINESS_URL: http://controller.openwhisk.svc.cluster.local:8080/invokers/healthy/count Mounts: /var/run/secrets/kubernetes.io/serviceaccount from default-token-qgb8n (ro) Containers: install-packages: Container ID: docker://b6f5d386f0417b762ece1b0965fe7c76a9c5b154ac555d2cbd30fbdaadde413d Image: openwhisk/ow-utils:570c044 Image ID: docker-pullable://openwhisk/ow-utils@sha256:f2627248291ed0f26638e837b583d92d840ad660a2cbac977d3cb8d082688157 Port: Host Port: Command: /bin/bash -c set -e; . /task/myTask.sh State: Terminated Reason: Error Exit Code: 3 Started: Mon, 17 Dec 2018 13:37:00 +0000 Finished: Mon, 17 Dec 2018 13:37:39 +0000 Ready: False Restart Count: 0 Environment: WHISK_AUTH: <set to the key 'system' in secret 'whisk.auth'> Optional: false WHISK_API_HOST: <set to the key 'whisk_api_host_nameAndPort' of config map 'whisk.config'> Optional: false WHISK_SYSTEM_NAMESPACE: <set to the key 'whisk_system_namespace' of config map 'whisk.config'> Optional: false WHISK_API_GATEWAY_HOST_V2: http://$(APIGATEWAY_SERVICE_HOST):$(APIGATEWAY_SERVICE_PORT_API)/v2 PROVIDER_DB_HOST: <set to the key 'db_host' of config map 'db.config'> Optional: false PROVIDER_DB_PROTOCOL: <set to the key 'db_protocol' of config map 'db.config'> Optional: false PROVIDER_DB_PORT: <set to the key 'db_port' of config map 'db.config'> Optional: false PROVIDER_DB_USERNAME: <set to the key 'db_username' in secret 'db.auth'> Optional: false PROVIDER_DB_PASSWORD: <set to the key 'db_password' in secret 'db.auth'> Optional: false ALARM_DB_PREFIX: alm CLOUDANT_DB_PREFIX: cldt KAFKA_DB_PREFIX: kp OW_INSTALL_ALARM_PROVIDER: no OW_INSTALL_CLOUDANT_PROVIDER: no OW_INSTALL_KAFKA_PROVIDER: no OW_GIT_TAG_OPENWHISK: 83de20ef2b7ef383a5708b59f36ba38e4cc279a8 OW_GIT_TAG_OPENWHISK_CATALOG: 3d6d69f3e2dba96c775d4b1a4d55b1fc158b1201 OW_GIT_TAG_OPENWHISK_PACKAGE_ALARMS: d3846ad810ef9838fe849613af23dec53bd92676 OW_GIT_TAG_OPENWHISK_PACKAGE_CLOUDANT: 3e0a90be16be5fc9e17928d3d70e230bfe4771b3 OW_GIT_TAG_OPENWHISK_PACKAGE_KAFKA: e242c13d05a11c4d2df5968e13ba1e0f3ef95c72 Mounts: /task/myTask.sh from task-dir (rw) /var/run/secrets/kubernetes.io/serviceaccount from default-token-qgb8n (ro) Conditions: Type Status Initialized True Ready False PodScheduled True Volumes: task-dir: Type: ConfigMap (a volume populated by a ConfigMap) Name: install-packages-cm Optional: false default-token-qgb8n: Type: Secret (a volume populated by a Secret) SecretName: default-token-qgb8n Optional: false QoS Class: BestEffort Node-Selectors: Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s node.kubernetes.io/unreachable:NoExecute for 300s Events:

Looks like myTask.sh is failing with exit code 3. I tried again with added "set -x" in myTask.sh.

-> kubectl logs install-packages-dg9dw -n openwhisk ++ export OPENWHISK_HOME=/openwhisk ++ OPENWHISK_HOME=/openwhisk ++ export PROVIDER_DB_URL=http://whisk_admin:some_passw0rd@couchdb.openwhisk.svc.cluster.local:5984 ++ PROVIDER_DB_URL=http://whisk_admin:some_passw0rd@couchdb.openwhisk.svc.cluster.local:5984 ++ git clone https://github.com/apache/incubator-openwhisk openwhisk Cloning into 'openwhisk'... /openwhisk / ++ pushd openwhisk ++ git checkout 83de20ef2b7ef383a5708b59f36ba38e4cc279a8 Note: checking out '83de20ef2b7ef383a5708b59f36ba38e4cc279a8'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at 83de20ef Fix package for system basic tests (#4138) / /openwhisk/ansible/roles/routemgmt/files / ++ popd ++ '[' '' ']' ++ export 'GW_USER= ' ++ GW_USER=' ' ++ '[' '' ']' ++ export 'GW_PWD= ' ++ GW_PWD=' ' ++ '[' http://10.233.52.250:9000/v2 ']' ++ export GW_HOST_V2=http://10.233.52.250:9000/v2 ++ GW_HOST_V2=http://10.233.52.250:9000/v2 ++ pushd /openwhisk/ansible/roles/routemgmt/files ++ ./installRouteMgmt.sh 789c46b1-71f6-4ed5-8c54-816aa4f8c502:abczO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP :31001 /whisk.system /usr/local/bin/wsk Installing apimgmt package error: Package update failed: Put https://:31001/api/v1/namespaces/whisk.system/packages/apimgmt?overwrite=true: dial tcp :31001: getsockopt: connection refused

Any inputs ?

dgrove-oss commented 5 years ago

https://:31001/api/v1/namespaces/ is the smoking gun. The whisk_api_host_nameAndPort entry in your whisk.config map has the port number 31001, but is missing the api_host. I would speculate that maybe you have a typo (or otherwise didn't set) whisk.ingress.apiHostName in your myCluster.yaml.

saurabh1284 commented 5 years ago

I got it.. It was typo.. I put api_host_name instead of apiHostName. replacing it works..Thx ! -> wsk api list -i ok: APIs Action Verb API Name URL -> wsk package list -i packages /whisk.system/combinators shared /whisk.system/weather shared /whisk.system/watson-textToSpeech shared /whisk.system/slack shared /whisk.system/watson-speechToText shared /whisk.system/github shared /whisk.system/utils shared /whisk.system/websocket shared /whisk.system/samples shared /whisk.system/apimgmt private