d4rkstar / kong-konga-keycloak

short tutorial to install kong, keycloak and konga in docker and test API authentication
281 stars 130 forks source link

Issue running kong #7

Closed bdkbdk123 closed 3 years ago

bdkbdk123 commented 3 years ago

Hi, after running migrations as described in readme, kong service does not start. This is the error I'm getting:


Creating v2_kong_1 ... done
Attaching to v2_kong_1
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] globalpatches.lua:10: installing the globalpatches
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] globalpatches.lua:243: randomseed(): seeding PRNG from OpenSSL RAND_bytes()
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] globalpatches.lua:269: randomseed(): random seed: 239462241410 for worker nb 0
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:449: init(): [dns-client] (re)configuring dns client
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:454: init(): [dns-client] staleTtl = 4
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:457: init(): [dns-client] validTtl = nil
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:461: init(): [dns-client] noSynchronisation = false
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:480: init(): [dns-client] query order = LAST, SRV, A, CNAME
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:520: init(): [dns-client] adding A-record from 'hosts' file: 16430fdf6cc9 = 172.24.0.3
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-mcastprefix = [ff00::0]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-localnet = [fe00::0]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:520: init(): [dns-client] adding A-record from 'hosts' file: localhost = 127.0.0.1
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: localhost = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-localhost = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-loopback = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-allnodes = [ff02::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-allrouters = [ff02::2]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:579: init(): [dns-client] nameserver 127.0.0.11
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:584: init(): [dns-client] attempts = 5
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:593: init(): [dns-client] timeout = 2000 ms
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:597: init(): [dns-client] ndots = 0
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:599: init(): [dns-client] search =
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:605: init(): [dns-client] badTtl = 1 s
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:607: init(): [dns-client] emptyTtl = 30 s
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:125: check_db_against_config(): Discovering used plugins
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:449: init(): [dns-client] (re)configuring dns client
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:454: init(): [dns-client] staleTtl = 4
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:457: init(): [dns-client] validTtl = nil
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:461: init(): [dns-client] noSynchronisation = false
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:480: init(): [dns-client] query order = LAST, SRV, A, CNAME
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:520: init(): [dns-client] adding A-record from 'hosts' file: 16430fdf6cc9 = 172.24.0.3
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-mcastprefix = [ff00::0]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-localnet = [fe00::0]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:520: init(): [dns-client] adding A-record from 'hosts' file: localhost = 127.0.0.1
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: localhost = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-localhost = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-loopback = [::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-allnodes = [ff02::1]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:535: init(): [dns-client] adding AAAA-record from 'hosts' file: ip6-allrouters = [ff02::2]
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:579: init(): [dns-client] nameserver 127.0.0.11
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:584: init(): [dns-client] attempts = 5
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:593: init(): [dns-client] timeout = 2000 ms
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:597: init(): [dns-client] ndots = 0
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:599: init(): [dns-client] search =
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:605: init(): [dns-client] badTtl = 1 s
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] client.lua:607: init(): [dns-client] emptyTtl = 30 s
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: correlation-id
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: pre-function
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: cors
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: ldap-auth
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: loggly
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: hmac-auth
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'hmac-auth.hmacauth_credentials'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: zipkin
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: request-size-limiting
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: azure-functions
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: request-transformer
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: oauth2
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'oauth2.oauth2_credentials'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'oauth2.oauth2_authorization_codes'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'oauth2.oauth2_tokens'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: response-transformer
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: ip-restriction
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: statsd
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: jwt
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'jwt.jwt_secrets'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: proxy-cache
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: basic-auth
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'basic-auth.basicauth_credentials'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: key-auth
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'key-auth.keyauth_credentials'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: http-log
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: oidc
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: datadog
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: tcp-log
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: rate-limiting
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: post-function
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: prometheus
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: acl
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:209: loader_fn(): Loading custom plugin entity: 'acl.acls'
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: syslog
kong_1         | 2021/03/03 12:32:51 [debug] 1#0: [lua] plugins.lua:247: load_plugin(): Loading plugin: file-log
kong_1         | 2021/03/03 12:32:51 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:620: error loading module 'kong.plugins.acme.handler':
kong_1         | /usr/local/share/lua/5.1/resty/acme/openssl.lua:5: attempt to index field 'version' (a nil value)
kong_1         | stack traceback:
kong_1         |    /usr/local/share/lua/5.1/resty/acme/openssl.lua:5: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/resty/acme/util.lua:1: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/resty/acme/client.lua:3: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/kong/plugins/acme/client.lua:1: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/kong/plugins/acme/handler.lua:2: in main chunk
kong_1         |    [C]: at 0x7ff322c800d0
kong_1         |    [C]: in function 'xpcall'
kong_1         |    /usr/local/share/lua/5.1/kong/tools/utils.lua:611: in function 'load_module_if_exists'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:149: in function 'load_plugin_handler'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:227: in function 'load_plugin'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:275: in function 'load_plugin_schemas'
kong_1         |    /usr/local/share/lua/5.1/kong/init.lua:427: in function 'init'
kong_1         |    init_by_lua:3: in main chunk
kong_1         | stack traceback:
kong_1         |    [C]: in function 'error'
kong_1         |    /usr/local/share/lua/5.1/kong/tools/utils.lua:620: in function 'load_module_if_exists'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:149: in function 'load_plugin_handler'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:227: in function 'load_plugin'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:275: in function 'load_plugin_schemas'
kong_1         |    /usr/local/share/lua/5.1/kong/init.lua:427: in function 'init'
kong_1         |    init_by_lua:3: in main chunk
kong_1         | nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:620: error loading module 'kong.plugins.acme.handler':
kong_1         | /usr/local/share/lua/5.1/resty/acme/openssl.lua:5: attempt to index field 'version' (a nil value)
kong_1         | stack traceback:
kong_1         |    /usr/local/share/lua/5.1/resty/acme/openssl.lua:5: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/resty/acme/util.lua:1: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/resty/acme/client.lua:3: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/kong/plugins/acme/client.lua:1: in main chunk
kong_1         |    [C]: in function 'require'
kong_1         |    /usr/local/share/lua/5.1/kong/plugins/acme/handler.lua:2: in main chunk
kong_1         |    [C]: at 0x7ff322c800d0
kong_1         |    [C]: in function 'xpcall'
kong_1         |    /usr/local/share/lua/5.1/kong/tools/utils.lua:611: in function 'load_module_if_exists'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:149: in function 'load_plugin_handler'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:227: in function 'load_plugin'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:275: in function 'load_plugin_schemas'
kong_1         |    /usr/local/share/lua/5.1/kong/init.lua:427: in function 'init'
kong_1         |    init_by_lua:3: in main chunk
kong_1         | stack traceback:
kong_1         |    [C]: in function 'error'
kong_1         |    /usr/local/share/lua/5.1/kong/tools/utils.lua:620: in function 'load_module_if_exists'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:149: in function 'load_plugin_handler'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:227: in function 'load_plugin'
kong_1         |    /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:275: in function 'load_plugin_schemas'
kong_1         |    /usr/local/share/lua/5.1/kong/init.lua:427: in function 'init'
kong_1         |    init_by_lua:3: in main chunk
v2_kong_1 exited with code 1
d4rkstar commented 3 years ago

Hello, i'm investigating. Thank you for you report

d4rkstar commented 3 years ago

It seems related to some kong-oidc plugin dependencies. Infact, if you change the docker-compose.yml file this way:

1) remove the "oidc" from the KONG_PLUGINS (line 51) 2) remove the build context (lines 26 and 27) 3) change the required image from "kong-oidc:latest" to "kong:2.0.4"

and start the kong service, you will not receive errors anymore, but - obviously - you will not have the oidc plugin :S

I think that the relevant error is: "openssl.lua:5: attempt to index field 'version' (a nil value)". I need some more time to investigate.

noukee commented 3 years ago

It is giving me the same error :(

d4rkstar commented 3 years ago

Hello @noukee. I am sorry, but unfortunately I have not yet found the time to thoroughly investigate a solution. I'll try this on the weekend.

d4rkstar commented 3 years ago

@noukee this is something to try: https://discuss.konghq.com/t/kong-ingress-fail-to-start-on-docker-desktop-kuberenetes-cluster-init-by-lua-error/7936

d4rkstar commented 3 years ago

@bdkbdk123 , @noukee: ok, i got a clue from the comment in the link above.

lua-resty-jwt seems 0.2.3-0 (released on 2021-01-21) seems to be incompatible with kong-oidc.

I've pushed a fix in branch fix-issue-7. Please let me know if it's ok also for you.

Andrej997 commented 3 years ago

Hello @d4rkstar ,

I'm having the same issue, I have looked in the branch fix-issue-7 and it is the same file as in master branch. Can you please write how did you fixed the issue?

Kind Regards

Andrej997 commented 3 years ago

I have fixed the issue by changing in Dockerfile from kong:2.0.4-alpine to kong:latest.

d4rkstar commented 3 years ago

@Andrej997 sorry. It was late and i forgot to push on the proper branch. take a look now in branch fix-issue-7

Regards

Andrej997 commented 3 years ago

That works too!

Thank you.

d4rkstar commented 3 years ago

Will merge the fix in master branch