Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: install apisix-ingress-controller by Kustomize #554

Closed
fhuzero opened this issue Jun 21, 2021 · 4 comments
Closed

request help: install apisix-ingress-controller by Kustomize #554

fhuzero opened this issue Jun 21, 2021 · 4 comments

Comments

@fhuzero
Copy link
Contributor

fhuzero commented Jun 21, 2021

Issue description

When I tried to install apisix-ingress-controller by Kustomize in a KinD cluster according to this, 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. 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.

@fhuzero fhuzero changed the title bug: install apisix-ingress-controller by Kustomize request help: install apisix-ingress-controller by Kustomize Jun 21, 2021
@tokers
Copy link
Contributor

tokers commented Jun 22, 2021

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

@fhuzero
Copy link
Contributor Author

fhuzero commented Jun 22, 2021

@tokers Thanks for pointing out the problem! I have configured admin_key in configmap to the default value and now the 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 clearer in another PR.

@tokers
Copy link
Contributor

tokers commented Jun 23, 2021

@fhuzero Sure, looking forward to your PRs.

@fhuzero
Copy link
Contributor Author

fhuzero commented Jun 25, 2021

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

@fhuzero fhuzero closed this as completed Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants