You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/06/21 15:43:20 UTC

[GitHub] [apisix-ingress-controller] fhuzero opened a new issue #554: bug: install apisix-ingress-controller by Kustomize

fhuzero opened a new issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554


   ### Issue description
   When I tried to install apisix-ingress-controller by Kustomize in a KinD cluster according to [this](https://github.com/apache/apisix-ingress-controller/blob/master/install.md#kustomize-support), the instruction says
   
   > Parameters are hardcoded so if the default values are not good for you, just tweak them manually.
   
   So I changed the container image version to the latest one (1.0.0). I set `apisix.base_url` in samples/deploy/configmap/apisix-ingress-cm.yaml to its default value `http://127.0.0.1:9080/apisix/admin`. And also tried to change apisix.base_url to `http://apisix-admin:9180/apisix/admin`, just as `--set config.apisix.baseURL=http://apisix-admin:9180/apisix/admin` when installing apisix-ingress-controller by Helm Charts.
   
   To verify the installation of apisix-ingress-controller, I followed this [example](https://github.com/apache/apisix-ingress-controller/blob/master/docs/en/latest/practices/proxy-the-httpbin-service.md). However, I cannot pass test in the example and got `{"error_msg":"404 Route Not Found"}`. One useful info for debugging is that its log says 401Authorization Required (shown below). So **my question is**: how to set base_url correctly or is there any other values need to be tweaked manually in order to pass the test? Thanks so much for helping me out!
   
   Misc: I used default API-key. apisix-ingress-controller code is cloned on June 21, 2021 (version 1.0.0).
   
   Here are some commands and output.
   ```
   $ kubectl kustomize samples/deploy/ | kubectl apply -f -
   Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
   customresourcedefinition.apiextensions.k8s.io/apisixclusterconfigs.apisix.apache.org created
   customresourcedefinition.apiextensions.k8s.io/apisixconsumers.apisix.apache.org created
   Warning: resource customresourcedefinitions/apisixroutes.apisix.apache.org is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
   customresourcedefinition.apiextensions.k8s.io/apisixroutes.apisix.apache.org configured
   Warning: resource customresourcedefinitions/apisixtlses.apisix.apache.org is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
   customresourcedefinition.apiextensions.k8s.io/apisixtlses.apisix.apache.org configured
   Warning: resource customresourcedefinitions/apisixupstreams.apisix.apache.org is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
   customresourcedefinition.apiextensions.k8s.io/apisixupstreams.apisix.apache.org configured
   serviceaccount/apisix-view-serviceaccount created
   clusterrole.rbac.authorization.k8s.io/apisix-view-clusterrole created
   clusterrolebinding.rbac.authorization.k8s.io/apisix-view-clusterrolebinding created
   configmap/apisix-ingress-cm created
   deployment.apps/ingress-controller created
   ```
   ```
   $ kubectl exec -it -n ingress-apisix apisix-6fc895b8d5-89jmj -- curl http://127.0.0.1:9180/apisix/admin/routes -H 'X-API-Key: edd1c9f034335f136f87ad84b625c8f1'
   Defaulted container "apisix" out of: apisix, wait-etcd (init)
   {"action":"get","node":{"nodes":{},"dir":true,"key":"\/apisix\/routes"},"count":"1"}
   ```
   ```
   $ kubectl exec -it -n ingress-apisix apisix-6fc895b8d5-89jmj -- curl http://127.0.0.1:9080/headers -H 'Host: local.httpbin.org'
   Defaulted container "apisix" out of: apisix, wait-etcd (init)
   {"error_msg":"404 Route Not Found"}
   ```
   
   Some commands for debugging purpose.
   ```
   $ kubectl get svc -n ingress-apisix
   NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
   apisix-admin           ClusterIP   10.96.33.120    <none>        9180/TCP            7m30s
   apisix-etcd            ClusterIP   10.96.246.235   <none>        2379/TCP,2380/TCP   7m30s
   apisix-etcd-headless   ClusterIP   None            <none>        2379/TCP,2380/TCP   7m30s
   apisix-gateway         NodePort    10.96.250.233   <none>        80:32703/TCP        7m30s
   ```
   ```
   $ kubectl get po -n ingress-apisix
   NAME                                  READY   STATUS    RESTARTS   AGE
   apisix-6fc895b8d5-89jmj               1/1     Running   0          6m24s
   apisix-etcd-0                         1/1     Running   0          6m23s
   ingress-controller-8679f9978f-2nnv2   1/1     Running   0          56s
   ```
   ```
   $ kubectl logs ingress-controller-8679f9978f-2nnv2  -n ingress-apisix
   2021-06-21T22:54:12+08:00       info    ingress/ingress.go:112  apisix ingress controller started
   2021-06-21T22:54:12+08:00       info    ingress/ingress.go:114  version:
   Version: 0.6.0
   Git SHA: no-git-module
   Go Version: go1.13.8
   Building OS/Arch: linux/amd64
   Running OS/Arch: linux/amd64
   
   2021-06-21T22:54:12+08:00       info    ingress/ingress.go:120  use configuration
   {
           "log_level": "info",
           "log_output": "stderr",
           "http_listen": ":8080",
           "enable_profiling": true,
           "kubernetes": {
                   "kubeconfig": "",
                   "resync_interval": "6h0m0s",
                   "app_namespaces": [
                           ""
                   ],
                   "election_id": "ingress-apisix-leader",
                   "ingress_class": "apisix",
                   "ingress_version": "networking/v1",
                   "apisix_route_version": "apisix.apache.org/v2alpha1"
           },
           "apisix": {
                   "default_cluster_name": "default",
                   "default_cluster_base_url": "http://apisix-admin:9180/apisix/admin",
                   "default_cluster_admin_key": "",
                   "base_url": "http://apisix-admin:9180/apisix/admin",
                   "admin_key": ""
           }
   }
   I0621 22:54:12.040921       1 leaderelection.go:243] attempting to acquire leader lease ingress-apisix/ingress-apisix-leader...
   2021-06-21T22:54:12+08:00       info    ingress/controller.go:273       LeaderElection  {"message": "ingress-controller-8679f9978f-2nnv2 became leader", "event_type": "Normal"}
   I0621 22:54:12.063949       1 leaderelection.go:253] successfully acquired lease ingress-apisix/ingress-apisix-leader
   2021-06-21T22:54:12+08:00       info    ingress/controller.go:353       controller tries to leading ... {"namespace": "ingress-apisix", "pod": "ingress-controller-8679f9978f-2nnv2"}
   2021-06-21T22:54:12+08:00       warn    apisix/cluster.go:288   waiting cluster default to ready, it may takes a while
   2021-06-21T22:54:12+08:00       info    apisix/cluster.go:139   syncing cache   {"cluster": "default"}
   2021-06-21T22:54:12+08:00       warn    ingress/controller.go:311       found a new leader ingress-controller-8679f9978f-2nnv2
   2021-06-21T22:54:12+08:00       error   apisix/route.go:117     failed to list routes: unexpected status code 401; error message: <html>
   <head><title>401 Authorization Required</title></head>
   <body>
   <center><h1>401 Authorization Required</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   === REPEATING LAST LOG ===
   2021-06-21T22:54:20+08:00       info    ingress/controller.go:320       controller now is running as a candidate        {"namespace": "ingress-apisix", "pod": "ingress-controller-8679f9978f-2nnv2"}
   I0621 22:54:20.097353       1 leaderelection.go:243] attempting to acquire leader lease ingress-apisix/ingress-apisix-leader...
   2021-06-21T22:54:20+08:00       info    apisix/cluster.go:139   syncing cache   {"cluster": "default"}
   2021-06-21T22:54:20+08:00       error   apisix/route.go:117     failed to list routes: unexpected status code 401; error message: <html>
   <head><title>401 Authorization Required</title></head>
   <body>
   <center><h1>401 Authorization Required</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ```
   ```
   $ kubectl logs --selector=app=apisix-ingress-controller -n ingress-apisix
   </html>
   
   2021-06-21T23:15:19+08:00       error   apisix/cluster.go:181   failed to list route in APISIX: unexpected status code 401; error message: <html>
   <head><title>401 Authorization Required</title></head>
   <body>
   <center><h1>401 Authorization Required</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ```
   ### Environment
   
   * your apisix-ingress-controller version (output of `apisix-ingress-controller version --long`);
   ```
   Version: 0.6.0
   Git SHA: f5cc76e
   Go Version: go1.15.13
   Building OS/Arch: linux/amd64
   Running OS/Arch: linux/amd64
   ```
   * your Kubernetes cluster version (output of `kubectl version`);
   ```
   Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}
   Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-18T01:10:20Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
   ```
   * if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (`uname -a`).
   N/A
   
   P.S. This issue is opened to continue the discussion in #338.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero edited a comment on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero edited a comment on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865624467


   @tokers Thanks for pointing out the problem! I have configured `admin_key` in configmap to the default value and now the [test](https://github.com/apache/apisix-ingress-controller/blob/master/docs/en/latest/practices/proxy-the-httpbin-service.md#test) can be passed.
   
   Would it be ok if I create a PR to change the default value of container image version, `apisix.base_url`, and `apisix.admin_key` to make the installation of apisix-ingress-controller by Kustomize ready to use? I may also make this [doc](https://github.com/apache/apisix-ingress-controller/blob/master/install.md#kustomize-support) clearer in another PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero edited a comment on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero edited a comment on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865624467


   @tokers Thanks for pointing out the problem! I have configured `admin_key` in configmap to the default value and now the [test](https://github.com/apache/apisix-ingress-controller/blob/master/docs/en/latest/practices/proxy-the-httpbin-service.md#test) can be passed.
   
   Would it be ok if I create a PR to change the default value of container image version, `apisix.base_url`, and `apisix.admin_key` to make the installation of apisix-ingress-controller by Kustomize ready to use? I may also make this [doc](https://github.com/apache/apisix-ingress-controller/blob/master/install.md#kustomize-support) clearer in another PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865460028


   @fhuzero It seems that you don't configure the `admin_key` parameter for apisix-ingress-controller so it cannot invoke the APISIX Admin APIs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-866444456


   @fhuzero Sure, looking forward to your PRs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero closed issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero closed issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865624467


   @tokers Thanks for pointing out the problem! I have configured `admin_key` in configmap to the default value and now the [test](https://github.com/apache/apisix-ingress-controller/blob/master/docs/en/latest/practices/proxy-the-httpbin-service.md#test) can be passed.
   
   Would it be ok if I create a PR to change the default value of container image version, `apisix.base_url`, and `apisix.admin_key` to make the installation of apisix-ingress-controller by Kustomize ready to use?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-868393986


   My PRs #557 and #558 are already merged. My question has been answered and I'll close this issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] fhuzero commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
fhuzero commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865624467


   @tokers Thanks for pointing out the problem! I have configured `admin_key` in configmap to the default value and now the [test](https://github.com/apache/apisix-ingress-controller/blob/master/docs/en/latest/practices/proxy-the-httpbin-service.md#test) can be passed.
   
   Would it be ok if I create a PR to change the default value of container image version, `apisix.base_url`, and `apisix.admin_key` to make the installation of apisix-ingress-controller by Kustomize ready to use?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on issue #554: request help: install apisix-ingress-controller by Kustomize

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #554:
URL: https://github.com/apache/apisix-ingress-controller/issues/554#issuecomment-865460028


   @fhuzero It seems that you don't configure the `admin_key` parameter for apisix-ingress-controller so it cannot invoke the APISIX Admin APIs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org